Solo Project
Through Xamarin Studio, C# and use of the Monte Carlo Tree Search algorithm, implemented an AI for the skilful playing of a digital version of the board game Othello.
Code Sample
// Select a Space according to the MCTS algorithm and change its color
public void GetMCTSMove(Player activePlayer, Player inactivePlayer)
{
this.activePlayer = activePlayer;
this.inactivePlayer = inactivePlayer;stopwatch.Restart();do
{
this.inactivePlayer = inactivePlayer;stopwatch.Restart();do
{
Node searchNode = TreePolicy (currentNode);
double reward = DefaultPolicy (searchNode);
PropogateResult (searchNode, reward);
double reward = DefaultPolicy (searchNode);
PropogateResult (searchNode, reward);
}while (stopwatch.ElapsedMilliseconds < TIME_BUDGET);
stopwatch.Stop();
// Value of 0 passed into GetBestChild to ensure no exploration, such that child with highest reward is selected
Node bestChild = GetBestChild(currentNode, 0);
currentNode = bestChild;
}
