AI Java program for playing Reversi, either against people or other AI agents.
-
Requires: Java 8.
-
Clone the repo, for a simple game run the following in 3 different terminals:
java -cp "ReversiServer/" Reversi 3
java -cp "ReversiHuman/" Human 127.0.0.1 2
java -cp "ReversiAI/" AI_Medium 127.0.0.1 1
Windows batch files with various game settings are included for ease of use.
-
The "Reversi" server program is neeeded to facilitate interactions between different players although it can be ran locally. It runs with 1 mandatory parameter representing the number of minutes before the game times out.
-
The "Human" program allows user input to manually test the AI and play against it. It runs with 2 mandatory parameters:
IPandPlayer Number. -
A number of different AIs are included with differing levels of skill. Descriptions are included below. All AI program runs with 3 parameters, the last one optional:
IP,Player Numberanddepthrepresenting the depth to which alpha/beta pruning is executed. The Easy, Medium and Hard levels have default depths they'll go until. -
The "Random" AI program runs 2 mandatory parameters:
IPandPlayer Numberand plays in a completely random fashion.It is included mostly for diagnostic purposes.
-
The IP address parameter should be
127.0.0.1if all processes are ran locally. -
The accepted player number values are 1 or 2 representing the order of play respectively.
-
The tree depth variable will quickly encounter memory constrainsts at a depth of 7 or more. A higher number leads to a stronger AI.
Have Java installed and click any of the bat files to run with that given specification.
From the root of the directory run the following commands in terminal.
- java -cp "ReversiServer/" Reversi {NumberMinutesOfGame}
- java -cp "ReversiAI_1/" {AI_LEVEL} {IP} {PlayerNumber} {OPTIONAL:TreeDepth}
- java -cp "ReversiHuman/" Human {IP} {PlayerNumber}
Note that two different human players can play together with a running server and appropriate IP addresses.