top | item 12228004

Show HN: Chessboardify – Make the grid a chessboard

95 points| mapehe | 9 years ago |chessboardifygame.xyz

33 comments

order
[+] jtokoph|9 years ago|reply
Neat variation on LightsOut (http://chenglou.github.io/react-lights-out/). I had some trouble since the rules for which lights toggle are slightly different with this one:

Classic lights out only toggles the light you press and the 4 lights in the 4 cardinal directions. I was surprised how baked into my brain that was and how much trouble I had getting my brain to adapt.

[+] kcorbitt|9 years ago|reply
I had a technical interview just last week wherein I was asked to write a program to determine whether a given lights out board could be solved or not! Hadn't ever seen the game before then.
[+] manav|9 years ago|reply
Thats exactly how I tried solving at first.
[+] rustyfe|9 years ago|reply
My only complaint is that the alert box prevents seeing the final board. It'd be nice to get to actually see my beautiful chessboard creations.
[+] mapehe|9 years ago|reply
That's how it behaves on my device, actually, and that indeed is how it's supposed to work. Thanks for pointing this out!
[+] mapehe|9 years ago|reply
I did a little update which should address this! Thanks again!
[+] lgas|9 years ago|reply
Dismiss the alert. Tada.
[+] mapehe|9 years ago|reply
I wanted to sketch this idea of a puzzle game that I came up with while on a walk. It turned out to roll pretty well though it couldn't be any more minimal.

Simple things are pretty powerful sometimes, don't you think?

[+] alxv|9 years ago|reply
Like Lights Out, this game can be solved using Gaussian elimination over Z/2 (integers modulo 2). This means the order of the tiles you press do not matter, and that you can solve the board by forming the desired pattern row by row.
[+] tgb|9 years ago|reply
Sorry how does it follow that you can form the pattern row by row? When you write this down as a linear algebra problem you kinda forget about the structure of the board, and the rows of the resulting matrix you apply Gauss elimination to don't correspond to the rows of the game board. So you must have meant something else that I'm missing, but I'm confused how you would solve just the bottom row without touching any others.
[+] memonkey|9 years ago|reply
This is interesting but I don't really understand because I've tried doing what you're saying. Maybe a side note: I'm very interested in learning algorithms but they are so inaccessible to me.
[+] Artlav|9 years ago|reply
Am i the only one who finds it more fun to try to get all the squares the same color, rather than into a chessboard?

Neat game.

[+] BariumBlue|9 years ago|reply
Got an excel solver for the 3x3

I'd share i'd via google spreadsheet if I could do it anonymously without creating a throwaway account

(All this in 3x3 grids, with the numbers mod 2)

- 1. Add the current light up state to the desired light state (chessboard)

- 2. Create a grid that's lit up as if from button presses from previous grid (using the game rules)

- 3. Flip the positions of the previous grid across the center. This grid is the grid of buttons to push

No idea how it works though, and it doesn't seem to work in the 4x4 case either

[+] Diggsey|9 years ago|reply
I just created a solver for the 4x4 case, also in google sheets... Who would have though it could handle ~15,000 rows with decent performance!

Works by calculating via formulae the result of any sequence, 6 moves or less. The bit patterns of each individual move are XORed together for each possible combination of moves.

The difference between the current state and the target is calculated, again via XOR, and then looked up in this data sheet via the query functionality, to give the sequence of moves which resulted in that delta bit pattern.

[+] dorianm|9 years ago|reply
I did it in one move ;). Pretty neat game.

http://imgur.com/f5sryfs

[+] mapehe|9 years ago|reply
Good job!

I think it's pretty amazing how good you get in this game once you play it a little more. At first it's simply impossible, but you start to recognize the patterns pretty quickly and you can usually beat the 3x3 ones in less than 10 moves.

[+] Grue3|9 years ago|reply
Is it me, or bigger boards are much easier than 3x3? You can pretty much build those row by row.
[+] mapehe|9 years ago|reply
I think it really depends on the size. Often the 5x5 feels like a breeze, but then 6x6 is a lot tougher. Probably there is some mathematical reason for this related to the divisibility of the grid side length.
[+] flippant|9 years ago|reply
What are you using Socket.IO for on the page?
[+] mapehe|9 years ago|reply
The puzzles are generated and the solutions are verified on the server. I'm passing data back and forth with that.