### Modulo Puzzle Rules

Posted:

**Wed Apr 25, 2007 4:02 pm**If you've tried the Modulo puzzle you will have noticed that the puzzle gets pretty insanely hard to solve by hand when you pass the first few levels.

We've made the HTML page very simple, so it is easy to parse and extract the puzzle parameters for any given level. You'll get the board layout, the list of shapes, and the board depth (how many colors can be on the board). You can also automate the submission of your solutions by requesting a URL with parameters.

Play the game, and see how far clever solvers can get.

Each puzzle is an initial board, where each cell has a color, and a list of pieces. When you put a piece on the board, all the cells on which a part of the piece lands moves to the next color. The 'next' color for a cell is the current color number plus 1, modulo the depth of the board. Grey is 0, blue is 1, Yellow is 2 (you'll see other colors as puzzle levels go up). For example, for a board of depth 3, if a piece hits a cell of color 1, the color will become 2. If a piece hits a cell of color 2, the color will become 0, etc...

You need to place all the pieces, in order, on the board such that when all pieces are placed, the board only contains cells with color 0.

As the levels go up, you will see the difficulty level go up (more pieces, larger boards, more colors).

Here are a few details that will help if you want to automate your puzzle solver:

If you look at the source of the HTML page for the puzzle, you'll see an <applet> tag and some applet parameters. There are 3 parameters to each puzzle: 'depth', which is the number of different colors that can be on the board; 'board', which gives a representation of the initial board; 'pieces', which gives the list of the pieces to put on the board.

The 'board' string is a sequence of rows separated by ','. Each row is a sequence of cells, where a cell is represented by its color number.
The 'pieces' string is a sequence of pieces separated by ' '. Each piece is a sequence of rows separated by ','. A row is a sequence of 'X' and '.', where 'X' is where the piece has a square, '.' is where the piece has a hole.

The URL for the puzzle is http://www.hacker.org/modulo/modulo.php

The URL will accept parameters in the query part of the URL:

name=<username>

password=<password>

To submit a solution, use the following parameter:

seq=<coordinates>

where the coordinates are the coordinates at which to put the pieces, in order, each coordinate being a CCRR where CC is a hex number for the column and RR the hex number for the row (top-left corner of the board is column 0, row 0). For example, to submit a solution where the first piece goes to (1,2), the second to (0,0) and the third to (3,1), you would to an HTTP GET on the following URL:

**This is normal**, the idea is that clever hackers will use all the resources at their disposition to solve the puzzle. For example, programming a puzzle solver on a computer, or network of computers, might helpWe've made the HTML page very simple, so it is easy to parse and extract the puzzle parameters for any given level. You'll get the board layout, the list of shapes, and the board depth (how many colors can be on the board). You can also automate the submission of your solutions by requesting a URL with parameters.

Play the game, and see how far clever solvers can get.

**RULES:**Each puzzle is an initial board, where each cell has a color, and a list of pieces. When you put a piece on the board, all the cells on which a part of the piece lands moves to the next color. The 'next' color for a cell is the current color number plus 1, modulo the depth of the board. Grey is 0, blue is 1, Yellow is 2 (you'll see other colors as puzzle levels go up). For example, for a board of depth 3, if a piece hits a cell of color 1, the color will become 2. If a piece hits a cell of color 2, the color will become 0, etc...

You need to place all the pieces, in order, on the board such that when all pieces are placed, the board only contains cells with color 0.

As the levels go up, you will see the difficulty level go up (more pieces, larger boards, more colors).

**NOTES:**Here are a few details that will help if you want to automate your puzzle solver:

**Get Parameters from the HTML page:**If you look at the source of the HTML page for the puzzle, you'll see an <applet> tag and some applet parameters. There are 3 parameters to each puzzle: 'depth', which is the number of different colors that can be on the board; 'board', which gives a representation of the initial board; 'pieces', which gives the list of the pieces to put on the board.

The 'board' string is a sequence of rows separated by ','. Each row is a sequence of cells, where a cell is represented by its color number.

Code: Select all

`Example: <param name="board" value="0101001,0010101,1000011,0001100,1101000">`

Code: Select all

`Example: <param name="pieces" value="XX..,XX..,.XXX X....,X....,XXXXX,XXX.. X...,XXXX,X... ...X,.X.X,XXXX,..X. .XX,XX.,.X.,.X.,.X. ..X,XXX XX..,.XX.,..XX,..XX,..X. X..X,XXXX,.X.. XX..,.XX.,..XX,..X. XX...,XXXXX,XX... .XX,XX.,X.. X..X,XX.X,.XXX,..X.">`

**Submit a Solution via an HTTP GET:**The URL for the puzzle is http://www.hacker.org/modulo/modulo.php

The URL will accept parameters in the query part of the URL:

name=<username>

password=<password>

To submit a solution, use the following parameter:

seq=<coordinates>

where the coordinates are the coordinates at which to put the pieces, in order, each coordinate being a CCRR where CC is a hex number for the column and RR the hex number for the row (top-left corner of the board is column 0, row 0). For example, to submit a solution where the first piece goes to (1,2), the second to (0,0) and the third to (3,1), you would to an HTTP GET on the following URL:

Code: Select all

```
http://www.hacker.org/modulo/modulo.php?name=<username>&password=<password>&seq=010200000301
```