A personal project to explore different forms of artificial intelligence using chess
_____________________________________________________________
Project Type: Personal Project
Duration: May 2016 – December 2018
Technologies: Unity Engine, C#
The focus of this project was to develop my AI skills. For this, several different algorithms were studied and implemented into a chess base. Each AI algorithm was designed to determine the best move possible. There were several different types of AI that were used for this project.
I made this AI focuses on ‘learning’ from playing many games of chess over time. Initially, the AI had a neural network with randomly weighted nodes. As it played, it would parse moves through the networks to determine which ones it thinks are best. Once the other player makes a move, it will backward propagate the result of their move through the network to adjust the weights.
This AI was not fully finished as it needed many more games to generate a smarter neural network.
I made this AI implemented the minimax algorithm which made use of Alpha-Beta pruning and Zero-sum pruning. This makes this AI a depth-first sorting algorithm.
With the Maximin algorithm, I got the AI to minimize the worst possible scenario that could occur from the next player's move. This is done by looking at all possible moves and all possible moves the other player could do from there, this determined the worst possible combinations of moves and whichever returned to best value was picked.
This process can take a long time, especially if the AI is looking several moves ahead, to minimize this time, I used a mix of Alpha-Beta Pruning and Zero-sum Pruning. I implemented Alpha-Beta Pruning to cut off nonviable paths by ending a search completely when at least one possibility has been found that proves the action to be worse than a previously examined action. Zero-sum Pruning allowed my to use the same code inversely when checking the opponent's possible moves
I made this AI focused on the idea of Optimal Decision Making. Through the use of many variables, I had it figure out the optimal move to take next.
Optimal Decision Making has three main parts:
Predicting the outcome of a decision
Assigns a value to that decision
Finds the decision that maximizes the value
This allowed the AI to makes judgements of each possible move then do the one that gives itself the greatest advantage over the opponent. This AI had the highest win-rate when play against the other AIs.
To allow a good environment for testing the AIs, and to allow myself to full control of everything, I build Chess in the Unity Engine from the ground up. It implemented all moves pieces could make in the game, from normal Bishop movements to Pawn's en passant. It also displays all the possible valid moves that a selected piece could do.
The hardest movements to determine was for the king when it is in check or checkmate. As I needed to figure out if the king could move, or determine if another piece could move to stop the king from being taken.