Live data from Hacker News

Show HN: Chessboardify – Make the grid a chessboard

chessboardifygame.xyz

21–30 of 37 posts

Re: Show HN: Chessboardify – Make the grid a chessboard

#21
post #3

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.

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.

Re: Show HN: Chessboardify – Make the grid a chessboard

#22
post #13

Earlier quoted context omitted.

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.

You should never have to use more than 9 moves for 3x3. Hitting the same square twice has no net effect, even if the two moves on the same square are separated by other moves.

You can actually knock that down to 8 moves (maybe less?) as the max required for a solution. You never have to press the middle square, since it flips every square, inverting the board. Inversion doesn't bring you closer to the checkered pattern of the chessboard. (An inverted chessboard... is a chessboard!)

Re: Show HN: Chessboardify – Make the grid a chessboard

#23
post #18

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.

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.

Re: Show HN: Chessboardify – Make the grid a chessboard

#24
post #18

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.

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.

Have you taken linear algebra? It gives a structure for solving systems of linear equations and the parent post is noting that the game state is a linear function of which squares you've pressed, when considering the states of a square as either one or zero and doing arithmetic mod 2. So the standard techniques of linear algebra can solve this system, such as Gaussian elimination. However, you still have to write down the large matrix that encodes what each square does (an n x n board will need an n^2 x n^2 matrix which shows how each square affects all the others once pressed). Then you solve that system.

For this particular game there is probably a more intuitive way to directly solve it.

Re: Show HN: Chessboardify – Make the grid a chessboard

#25

Earlier quoted context omitted.

You should never have to use more than 9 moves for 3x3. Hitting the same square twice has no net effect, even if the two moves on the same square are separated by other moves.

You can actually knock that down to 8 moves (maybe less?) as the max required for a solution. You never have to press the middle square, since it flips every square, inverting the board. Inversion doesn't bring you closer to the checkered pattern of the chessboard. (An inverted chessboard... is a chessboard!)

I just posted this on Facebook: https://www.facebook.com/chessboardify/?fref=nf

There is a lot of math involved in this game and you can quite quickly note some less obvious rules like this one. Maybe there are some very nontrivial, but interesting things out there. I'm not good enough in combinatorics to tell... :D

Re: Show HN: Chessboardify – Make the grid a chessboard

#26

Earlier quoted context omitted.

You should never have to use more than 9 moves for 3x3. Hitting the same square twice has no net effect, even if the two moves on the same square are separated by other moves.

You can actually knock that down to 8 moves (maybe less?) as the max required for a solution. You never have to press the middle square, since it flips every square, inverting the board. Inversion doesn't bring you closer to the checkered pattern of the chessboard. (An inverted chessboard... is a chessboard!)

8 moves are sometimes required. If you have a chessboard 3x3 grid with the middle square the wrong color, you have to flip all squares except the middle.

Re: Show HN: Chessboardify – Make the grid a chessboard

#27

Earlier quoted context omitted.

You should never have to use more than 9 moves for 3x3. Hitting the same square twice has no net effect, even if the two moves on the same square are separated by other moves.

You can actually knock that down to 8 moves (maybe less?) as the max required for a solution. You never have to press the middle square, since it flips every square, inverting the board. Inversion doesn't bring you closer to the checkered pattern of the chessboard. (An inverted chessboard... is a chessboard!)

Actually, a chessboard has a light colored square on the bottom right. This game accepts either a chessboard or an inverse chessboard.

Re: Show HN: Chessboardify – Make the grid a chessboard

#28
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

Post reply on HN