Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puzz.link Support #41

Open
32 tasks done
swaroopg92 opened this issue Sep 10, 2021 · 7 comments
Open
32 tasks done

Puzz.link Support #41

swaroopg92 opened this issue Sep 10, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@swaroopg92
Copy link
Owner

swaroopg92 commented Sep 10, 2021

Users can load puzz.link puzzles into Penpa+ using the "Load" button.
It currently supports (not full list, check Readme file for complete list):

  • Akari
  • Ayeheya
  • Balance Loop
  • Country Road
  • Detour
  • Haisu
  • Heyawake
  • Kakuro
  • Kurochute
  • Kurodoko
  • Kurotto
  • Masyu
  • Maxi Loop
  • Mid loop
  • Moonsun
  • Nanro
  • Nurikabe
  • Nurimisake
  • Ripple Effect
  • Shakashaka
  • Slitherlink
  • Skyscraper
  • Star Battle
  • Sudoku
  • Fillomino
  • Araf
  • Aqre
  • Compass
  • Easy as ABC
  • Yajilin
  • Nonogram
  • Kropki
    Any other genre please comment below.
@swaroopg92 swaroopg92 added the enhancement New feature or request label Sep 10, 2021
@swaroopg92 swaroopg92 added this to To do list in Features to Implement via automation Sep 10, 2021
@nmay231
Copy link
Contributor

nmay231 commented Sep 11, 2021

Hi! I'm willing to contribute one or more of these puzzle parsers. When I can allocate some free time, I'm thinking of adding Heyawake, Slitherlink, Tents, and/or Fillomino.

  • Are there any issues with adding any of those, or do you have a preference of which one to do first? I have no personal preference, I just chose those because the features required are available in Penpa+, and I'm familiar with them.
  • On a side note, I'm not able to place trees when using "tents" controls (Composite>Object>Tent). Is this intended?

Thanks for maintaining this awesome piece of software, btw 👌

@swaroopg92
Copy link
Owner Author

Hi @nmay231,

  1. Sure, please go ahead. Submit a PR as you implement. I started this mainly to solve the puzzle genres for which the Penpa interface is more friendly (specially numbered puzzles). But there is no reason not to add other types as well. It's mainly time so I prioritize the above ones which I listed. So your help is greatly appreciated and would be a good addition. No priority for me, feel free to add in any order as you please.
    Let me know if you have any questions.
  2. Composite modes are for solving, so yeah it's intended. To solve a Tent's puzzle you only need to place tents and dots. While creating a puzzle to place trees, use Shape -> Special 1 -> Trees (3rd Option)

Thank you very much. I am glad you find it useful.

@swaroopg92 swaroopg92 moved this from To do list to Current Progress in Features to Implement Sep 11, 2021
@swaroopg92
Copy link
Owner Author

@nmay231 One of the users (RSP) in the discord server provided this analysis/information that might help. Since you are doing most of puzz.link parsing, thought to share it here:

unnumbered
lits
norinori

numbered
aqre
shimaguni
stostone
heyawake
ayeheya
country
yajilin-regions*
maxiloop*
detour*
nagenawa*
factors*
juosan*
* renders differently

almost works: toichika. arrows dont render

used url p?[id]/10/10/5k88hh20i142e2c5880g3o03vs0001fs02030g123g4g5 

then we have another group of multiple numbers in a region. they work the same minus how they parse ? and illegal numbers
armyants
nanro
cojun
renban
meander
bonsan*
heyabon*
satogaeri*
* renders differently

(doesnt quite work)
usoone - works if no illegal numbers (5+)
hanaregumi - works, but creates illegal clues
putteria - works, but creates illegal clues. renders ? as x
makaro - numbers all become +1


used url p?[id]/10/10/5k88hh20i142e2c5880g3o03vs0001fs02030g1k4k23r5l6o7zi.zp 
there's also aquarium, kinkonkan, paintarea and sukuroroom (and probably more that i accidentally lost) that just do whatever they want basically

@nmay231
Copy link
Contributor

nmay231 commented Oct 18, 2021

@swaroopg92 Good to know! I'll use that list when I get back to adding more.

@x-sheep
Copy link

x-sheep commented Mar 26, 2022

Here's some information for conversion of the current genres on pzprxs, and how complex it is to implement:

Exact copies:

  • canal -> nurikabe
  • oneroom -> heyawake

Identical encoding, needs different input

  • cbanana -> nurikabe
    Use default Surface coloring

  • rassi -> doubleback
    Change input mode to Rassi Silai composite mode

  • tontti -> nurikabe
    Change input mode to Line > Middle.

Identical encoding, needs rendering tweak

  • dotchi -> moonsun
    Render white and black circles instead of sun and moon.

  • chainedb -> nurikabe
    Render numbers inside black squares.

Uses specific encodings

  • crossstitch
  • lohkous
  • ovotovata
  • bdwalk
  • voxas

@swaroopg92
Copy link
Owner Author

Thanks @x-sheep that's great information and will help in accelerating the development. We will surely reach out to you if any questions. @nmay231 Sorry just tagging you, to make sure you are aware of this information :)

@nmay231
Copy link
Contributor

nmay231 commented Apr 30, 2022

For those who want to support more of the puzzlink puzzles, here are some tips and things to remember:

  • To figure out how puzzle variants are encoded in their URLs, it's easiest to clone the projects and read the files directly. puzz.link and x-sheep's fork
  • Open pzprjs/src/pzpr/variety.js. It contains a list of information about all variants including the filename (some variants are in the same file) and aliases, if any exist. For example, the Cave variant is implemented in src/variety/kurodoko.js and has four aliases cave, bag, corral, correl. Decoding/parsing for each variant is done in the decodePzpr() method.
  • In Penpa, the parsing is done in docs/js/general.js in decode_puzzlink() with some support functionality in puzzlink.js.
  • To prioritize which variants would be most helpful, you can use the following Python script to see how many puzzles are present in https://puzz.link/db. Though that is just a suggestion. Feel free to implement your favorite variant.
import requests

def puzzlink(tag_name, count = 100):
    url = (f"https://puzz.link/db/api/pzvs_anon?limit={count}&sort_key=gt.0&order=sort_key.asc&type=in.(%22{tag_name}"
          + "%22)&generated=eq.false&tags_filter=cs.%7B%7D&tags_filter=not.cs.%7Bbroken%7D")
    return requests.get(url).json()

print(len(puzzlink("cave")))

Things that are easy to forget:

  • Check how "." in the puzzle URL-string is rendered. Some puzzles render it as a question mark while others leave it blank.
  • Update certain files:
    • Include the genre tag(s) of the variant(s) in docs/js/genre_tags.js
    • Add tests to test/public/puzz_link.js
    • Add urls to TESTING.md
    • Update support of the variant(s) in the README.

That said, feel free to ask me or swaroopg92 if you have any questions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Features to Implement
  
Current Progress
Development

No branches or pull requests

3 participants