Valid Peg Puzzle Solution
00000000000000000111111111111110
00000000000000000111111111110101
00000000000000000111111111001101
00000000000000000111111111101000
00000000000000000111111110100010
00000000000000000111110110000110
00000000000000000111010100010110
00000000000000000110010000110110
00000000000000000110010100100100
00000000000000000110011100000000
00000000000000000010010100100000
00000000000000000011010000000000
00000000000000000000110000000000
00000000000000000001000000000000
The explaination regarding what these bits mean now follows. The state of the triangular board is represented by using an unsigned 32 bit integer. The first (or the most significant) 17 bits are always zero since we use only the lower bits to represent the 15 pegs on the puzzle board. The least significant bit is zero if there is no peg in position 1 (refer to the board diagram in the previous blog) or it is set to 1 if there is a peg. Similar the the 2nd least significant bit is zero if there is no peg in position 2 or else it is set to 1.
0 Comments:
Post a Comment
<< Home