nmay231 / lattice-grid

A web app to set your own puzzle using a classic variant like sudoku or one you created yourself!
https://latgrid.vercel.app
MIT License
0 stars 0 forks source link

Puzzle constraints #6

Open nmay231 opened 1 year ago

nmay231 commented 1 year ago

Description

In general, constraints are what give good puzzles only one solution. In Latgrid, there are many types of constraints that are available to the setter to restrict what the solver will do. Some are implicit, like the size and shape of the grid or what objects can be drawn with the given controls, others are explicitly programmed by the setter, like no repeating digits allowed in a row, column, or box of a sudoku. All of these constraints will do (at least) two things. 1) They inform the solver what puzzle the setter had in mind and allow solvers to catch simple mistakes early (if they enable error highlighting). 2) It could enable automatic solvers to guide the setter in what's possible and try out puzzle designs without having to manually work out all the logic him-/her-self.

Because of this dual-goal mindset, I eventually want to structure explicit constraints to have a form that caters well to both. Aka, you add code for error highlighting and get auto-solver logic for free. But I have to start somewhere, so I'm just going to get some simple error highlighting going.

Basic plan going forward

Let me think of the easiest form to implement so I can get some code going.

nmay231 commented 1 year ago
nmay231 commented 1 year ago

Don't worry about the continuity of this "discussion." This is more of just a dumping ground for ideas. :smile: