Posted 02 May 2013 - 01:39 AM
Learning Intelligence: Nim
QuantumGrav
Learning Intelligence: Nim, is a program that learns how to play a simplified version of the game, Nim.
Nim begins with a number of objects and a maximum number of objects that can be taken on any one turn. The goal of this specific type of Nim is to force your opponent to take the last piece. The game is remarkably simple, and there is always one correct move in any position. This allows a trial and error approach to the game, searching for that one move and recording it when it's found.
The program picks from its available moves and records their success once the game is over, rating it +1 if the computer won, and -1 if the player did. It saves all its experiences to a file called "NimHistory." If you play perfect Nim against it, it learns quite quickly. Even if you don't, it will still eventually learn. I highly encourage you to pick a certain max and starting number, and then see how quickly you learn to play perfectly as opposed to it. I did so, and though at first I consistently beat it, it quickly learned, and destroyed me. The first time it beats you, it might sting just a little!
Also, you can have it play itself a number of times to have it improve it's abilities on its own.
Features: Both advanced and non-advanced computers supported, key and mouse compatible menu, a nice GUI, a self improvement system, and of course, it learns when playing you!
Screenshots:
Spoiler
[attachment=1135:2013-04-24_22.51.06.png][attachment=1136:2013-04-24_22.51.24.png]
[attachment=1137:2013-04-24_22.51.35.png]
This is a pretty cool concept, and could easily be applied to other simple games like tic-tac-toe, and maybe with some modification, more complex games like connect-four and checkers.
That does it! If you have any feedback, find a bug, or would like a feature added, let me know! The pastebin link is at the top and again below.
Enjoy!