Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Minesweeper on a chess board with chess pieces as mines
43 points by chedoku on Jan 14, 2023 | hide | past | favorite | 22 comments
rearrange the chess pieces so that the number of pieces threatening each square matches the large number in that square? pieces move freely

https://chedoku.com/#dailypuzzle




This is really cool. I wish the pieces were off the board at the start though. I’d much prefer to build up a solution iteratively than try to fix a broken one.


I totally agree. This was the technical limitation of the library that I was using (chessboardjs). If pieces are off board, there is no easy way to limit the number of pieces that you add to the board. Finding a better solution is on my todo list.


Do you think there’s a way to “rate” a particular solution? I’m wondering about how to gauge “efficiency” in placing the pieces. Fewest “wasted” threat squares maybe?


I am not sure what this question has to do with the previous comment and why it is not asked in a separate thead! am I missing a point in your question?

Back to your question. There are two types of solutions: 1- Perfect solution, you get a green notification when you find the solution, in which other squares with no number have zero threats. Pressing the 'solution' button reveal the perfect solution 2- Imperfect solution, you get a yellow notification when you find one, in which other squares with no number may be under one or more threats.

As a simple example, for the puzzle below placing pawn on c2 is an imperfect solution but placing it on a2 is the perfect solution.

https://chedoku.com/#gid=3&d=1&

Is perfect solution in my terminology is what you mean by efficiency solution?


This is really fun, and it definitely tickles that same part of the brain as sudoku.

One UI suggestion is to use a diverging color palette for the larger numbers so there are different hues for too many versus too few attackers.


I am glad you like it. This is actually a great (and easy to implement) idea. I will fix this in the next release. Thanks for the suggestion


Would also be awesome if there was deterministically only a single solution, though that may be hard to create.


This is something that bugged me for a long time. There are many other challenging algorithmic questions that I will share in a separate blog post later (e.g. writing a efficient solver). If you have any idea how to do that I would love to hear about that.


Looks like this could be translated into a SAT problem and solved with a SAT solver. Have you tried that?


I have actually used SAT solver before but I have no idea how to translate this into a SAT problem. I know it is too much to ask you to do it for me but maybe you can give me a hint (or link) on how to translate problems that deal with numbers into boolean expression that can be solved by a SAT solver.


I’m not an expert in it either, but this problem is similar to both the N-queens problem and Sudoku, both of which can be solved via SAT, so tutorials for those should be a good start. Good luck!


Also some explanation of what makes a solution "perfect" would be nice.


Thanks for you comment. I am working on it now. 1- Perfect solution, you get a green notification when you find the one, in which other squares with no number have zero threats. Pressing the 'solution' button reveal the perfect solution

2- Imperfect solution, you get a yellow notification when you find one, in which other squares with no number may be under one or more threats.

A bit confusing so for now I try not to be strict about imperfect solutions.


there's a whole extra knight in today's puzzle

edit: i meant if you (r13: ebbx naq xavtug ba oynpx'f xvat'f ovfubc naq xavtug cbfvgvbaf) you only need to use two of the three provided


It was promoted from a pawn ;)

joke aside, there can be: 1- any arbitrary number of pieces on the board 2- pawns in the first and last rows 3- missing king 4- missing opposite color pieces


I've been playing the daily puzzle for a week, it's fun. Well done :-)



This is actually good! Well done :)


I am very glad you like it and thanks for taking the time to write the comment :)


Super fun!


Thanks, happy you liked it :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: