This program uses the Minimax Algorithm to figure out the best possible move even in the worst positions. The program also has a CUI written using ncurses, so it's ready to play!
- Clone this repository and CD into it
git clone https://github.com/goodboyneon/tictactoe.git cd tictactoe
- Compile the program
make # If you do not want to use make, run build command from Makefile
- Run the program
./main
This is the rendered image you should see on your screen after you run the program
-
To make a move, simply press the number corresponding to the specific square
Tip: If your keyboard has a numpad, you might realize that the positions of the number keys on the numpad are the same as the numbers for each of the square. For example, you can press the top left key on the numpad (i.e. 7) to play the top left square on the tic-tac-toe grid!
-
The program randomly assigns you a token (either X or O) at the start of each game. Therefore, you have a 50-50 change or getting either token
-
Whoever gets the X token is the one who plays the first move.
I am very thankful that you decided to invest time and energy into this project. To contribute,
- clone this repository and make a new branch:
git checkout https://github.com/goodboyneon/tictactoe -b replace_with_branch_name
. - You can make your changes on that branch and submit a Pull Request. Please make sure your code prioritizes readability and that your PR's content is descriptive and straight-to-point.