Enigma 1256For the programmers: Write a program that solves the above puzzle algorithmically, and outputs the solution as sequence of moves, where each move is separated by a new line, and is expressed as a letter, R (for red face up) or B (black face up) and two dimensional coma separated coordinate in the range 1 to 5 inclusive, for example:
High turnoverImagine a game played on a 5x5 grid.
You have two sided counters, red and black.
You place the counters on the grid, one at a time.
For each counter you place, and counters on adjacent squares are flipped.
The goal is to finish with all red counters.
R 1,1(This, by the way, should be a winning solution for a 2x2 grid)
B 1,2
B 2,1
R 2,2
Bonus points for style. I expect a brute force search will suffice, so I'm looking for anything that goes a step further than that. I expect a directed game space search with a smart heuristic will win, but you can try to prove me wrong if you like.
An entry should be posted in the form of a comment describing the source code solution, and a reply to that comment containing the source code. Updates, patches and bug fixes should be posted as full source code listings as replies to the comments containing the source code they replace.
There will be a small, but real, physical prize. Attempting to "cheat" the spirit of the game whilst keeping within the letter of the rules will lead to disqualification.
| < It's lunch time! | BBC White season: 'Rivers of Blood' > |

Post to Twitter
