A program made to play a generalized version of connect 4 perfectly
If you are on Linux or macOS you can simply run the following command in the project directory:
$ ./gradlew build
If you are so unlucky to work on Windows, the following command should work:
$ gradlew build
After the project built successfully, you can test computer vs computer with the following command:
$ java -jar build/libs/connectx.jar 6 7 4 connectx.Players.L0 connectx.Players.L1
If you are on Windows remember to change the /
to the \
for the path.
There are additional flags to use in order to specify different configurations:
- With
-v
the output will be verbose - With
-t
you can specify a maximum time of each move - With
-r
you can specify how many rounds need to be played.
Verbose output and customized timeout (10 sec) and number of game repetitions (2 rounds) should look like this:
$ java -jar build/libs/connectx.jar 6 7 4 connectx.Players.L0 connectx.Players.L1 -v -t 10 -r 2
In gradle.build
the main class is specified, if you want another class to run
as main (for example the CXGame) you can simply uncomment the commented line.
There is a bash script with the name full_test.sh
that allow to use the
CXPlayerTester
with all the board configurations stored in board_configurations.txt
.
The use is pretty simple: you just need to pass two player names in the command line
and the script will do the rest.
./full_test.sh L0 L1
If you want the verbose output just use the -v
flag.