HEX C++

 

 

Hex logo

 

A project made strictly in C++ that uses a Monte Carlo AI to simulate 1000 games for every move in the board. The board is searched recursively for any winning paths, and uses modules for more organized code.

Hex is a board game where the players must create a path of their pieces from one side of the board to the other, while preventing the other player from making a path from the remaining to sides. This program was originally made in an Advanced Programming class at UCSC, and after completing college and Split It, I have now decided to take even further by adding additional features onto it in order to learn new practices and solve new design problems in C++. Specifically, I wanted to learn about threading and how to use it, as well as create a fully functioning application with a software loop and GUI.

Currently it runs in an SFML window, with the command prompt optionally running in the background to show what the AI’s resulting calculations are. This project uses

  • Monte Carlo AI, simulating 1000 games per move in just a few seconds in order to come up with the best move to win
  • Threading, both to split the board and do multiple calculations simultaneously and therefore speed up the process, and a graphics thread in order to prevent freezing during calculations
  • SFML, used for the GUI
  • Visual Studio Express 2015 for the IDE

Here’s what starting the program looks like:

And here’s what winning and resetting the game as the other piece color looks like:

Source control was used to manage this project via Github and SourceTree. The github for the project can be found here:

https://github.com/cdilday/Hex_Game

Programmer, Game Designer