Five Pawns, a Simple Chess Game
At the beginning of this year, I released Four Pawns, a very basic strategy game. The idea is simple – on a 4x4 chess board, two players each have four pawns, and you win by either getting a pawn to the other side of the board, eliminating all the other players pieces, or blocking them from moving.
The concept is simple enough, and I wrote a decent AI system for it, but it was relatively easy to win the game, because I limited the amount of processing per turn that the computer would do to pick a move. As a result, the computer wasn't able to look as far ahead as a human player might, and didn't win as much.
The general solution to this is to precompute a couple million boards, and store the results. Then, the AI just looks it up. The AI gets a lot smaller, and also a lot faster. So, I wrote some code to do this, outputted it in a way that made a file that wasn't too huge, and updated the game.
That makes the 4x4 version of the game virtually impossible to win for a human. Basically every move has been computed, and the computer will kick you ass over and over again.
My real plan the whole time was to make a 5x5 version of the game, but Five Pawns failed because the AI was even more limited than in Four Pawns, so it was pretty easy to beat. But now, with a couple bazillion moves computed, it's a lot smarter. Here goes:
UPDATE: Code available on github