keiranking / Phil

A crossword maker.
http://www.keiranking.com/phil
Apache License 2.0
282 stars 85 forks source link

Clues & numbering for non-Times grids #16

Open dnapoleoni opened 5 years ago

dnapoleoni commented 5 years ago

Loving this program! I know it's designed for NY Times grids but I'm trying to use it for an Aussie/British style layout and it's having problems working out where the clues are. I've taken a browse through the code and it seems that it's only checking whether the previous square is black before deciding there's a clue there - which in the rest of the world's grids means a whole lot of extra numbers.

I've attached a demo .pdf to show what I mean: blank-grid.pdf

I've taken a look at the code and I think I've worked out a simple fix, one that checks whether a black square is before AND after each white square before determining its viability. This should still leave the NY-times version unchanged while supporting other grid layouts!

cross.js, lines 542 & 543:

isDown = i == 0 || xw.fill[i - 1][j] == BLACK && i == xw.rows - 1 || xw.fill[i + 1][j] != BLACK; 
isAcross = j == 0 || xw.fill[i][j - 1] == BLACK && j == xw.cols - 1 || xw.fill[i][j + 1] != BLACK;

Hope it helps, Dan

dnapoleoni commented 5 years ago

I finally worked out how to fork and set up your repo and just added the changes myself - including a few extra minor UI/navigation tweaks and an undo/redo history stack!

Check it out here and let me know what you think - it should still be working for the regular NYT-style puzzles as well as accommodating other styles with numbering intact.

Happy to send the changes over in a pull request if they're something you're keen to fold into the original master! Not really sure how to do that exactly but can look it up.

Cheers, Dan