Solitaire AI

Technical Skills:
| C++ |
Solitaire AI was a small project I worked on during the summer of 2017. The goal of the project was to create an artificial intelligence that can play the card game solitaire.

Due to this being just a pet-project, no advanced solitaire techniques were researched to increase the AI's win rate. Instead my own tactic was converted into an algorithm, therefore causing the bot to mimic my playstyle and theoretically equal my skill level.

The game was initially designed and tested through user input to ensure there was no problems with the rules before the AI was introduced. This means that it could also stand alone as a command line implementation of solitaire that can be played by humans. The human player manipulates the game's board through the commands "NEWGAME", "DRAW" and "MOVE".

In fact, very basic AI is implemented into the game itself to help streamline the user input. For example, the basic "MOVE" command takes three integer parameters (x, y, destination) to move a card from column x's row y to the destination column. However, the same command can be issued with just the x and destination parameters. This causes the game to find the only move that is possible from column x to the destination and play it. The "MOVE" function can even be overloaded one more time to handle just a single (x) parameter. This judges all valid moves from all cards in column x to all other columns (including the suit slots) and plays the best available move.

The AI player was then developed to only be able to read face-up cards, and only be able to use the same input commands as a human. Therefore preventing an omniscient AI and creating true reflection of a human.

The source code for this project is available from here.