A Tic-Tac-Toe game with AI by implementing the Minimax algorithm.
Make sure you are in the game root directory. Then run the following command in the terminal:
java -jar tictactoe.jar
To build the game from source, follow these instructions:
While in game root directory, execute the following command in terminal.
javac -d class/ src/Game.java -cp src/
The -d
flag is used to store the output to different directory. The -cp
flag is used to specify class path. The code won't compile without this flag as there are multiple source files in different folder.
Next, change to the class directory:
cd class/
Now, just execute the game while in class directory:
java Game
To pack all classes and resources in a single file, we have to create a jar file. While in the class directory, execute the following in terminal:
jar -cmvf tictactoe.mf ../tictactoe.jar *.class
This will create a jar file in the root directory of the game. Navigate to root directory:
cd ..
To execute the jar file, just run:
java -jar tictactoe.jar
This jar file is portable. You can play the game just via this file.
Enjoy!!