This game requires that you have java
and maven
installed on your machine.
Please run java -version
from the command line to check if you have java.
If you have Java, your output should be similar to the one below.
If you get a different output, then follow the instructions at this link: Getting Java 9
Once you've installed Java, you'll need to make sure you have Maven so that you can create a game package and run the test suites.
Please run mvn --version
from the command line to check if it is installed.
If you have Maven, your output should be similar to the one below.
If you get a different output, then the easiest way to get started is with the package manager Homebrew. To check if you have Homebrew, please run brew --version
.
If you don't, installation is very easy, just follow the instructions at this link: Installing brew. Once you have Homebrew, you can install maven using the command brew install maven
.
-
Run
git clone https://github.com/GeorgeSmith-Sweeper/JavaTTT.git
in your terminal. -
Run
cd JavaTTT
. -
Run
mvn package
at the root. -
Run
java -jar target/JavaTicTacToe-1.0-SNAPSHOT.jar
at the root to start the game.
The game will begin by displaying a prompt for a board size.
Next you can select symbols for the player 1, and player 2.
Next is a game mode prompt.
If you've chosen to play against the Ai you will be given the option of three difficulty levels.
Finally you will be asked if you would like to have the first move.
There are 61 tests for this game! The tests can executed my running mvn test
at the root.
The computer is unbeatable when played on a standard 3x3 board (seriously it's kind of a jerk), however when played on boards of 4x4 or greater, it gets bogged down in move computations, and fails to make a move in an acceptable time. The next version of Tic-Tac-Toe will add Alpha-Beta pruning to my negamax function, in order to prune number of branches that the computer must search for the 'best move'. This will allow the computer to handle larger board sizes while remaining unbeatable.
Posts by crafters at 8th-Light who also did negamax: