- C++17 compiler (GCC 7+, Clang 5+, or Apple Clang)
- CMake 3.16+
- pthreads (included on macOS/Linux)
Quick build (tournament-optimized):
cd quarto-cpp
./build_release.shThis produces build_release/quarto-ai — a stripped, LTO-optimized binary.
Development build:
cd quarto-cpp
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
makeDebug build (with AddressSanitizer):
cmake -DCMAKE_BUILD_TYPE=Debug ..
make./quarto-ai --host <server-ip> --port <port> --username <name> --threads <n>| Flag | Default | Description |
|---|---|---|
--host |
localhost |
Server IP or hostname |
--port |
12345 |
Server port |
--username |
ChokerJokerCpp |
Player name (must be unique on server) |
--threads |
auto (all cores) | Number of search threads |
--help |
— | Show usage |
Terminal 1 — Start the Java server:
java -jar dist/server.jarTerminal 2 — Start the C++ AI:
./quarto-cpp/build_release/quarto-ai --host localhost --port 12345 --username Bot1Terminal 3 — Start a second player (Java AI or another C++ instance):
./quarto-cpp/build_release/quarto-ai --host localhost --port 12345 --username Bot2Both clients auto-queue and start playing when matched.
- Runs built-in self-tests (game state, message parsing, Zobrist hashing)
- Connects to server via TCP
- Sends
HELLO-> receivesHELLOback - Sends
LOGIN~<username>-> receivesLOGINconfirmation - Sends
QUEUE-> waits for opponent - On
NEWGAME-> starts playing with ChokerJoker AI - After game over -> automatically re-queues
All diagnostic output goes to stderr. You'll see:
Testing game.hpp...
game.hpp tests passed!
parse_message tests passed!
Zobrist & symmetry tests passed!
Quarto AI C++ Client
Host: localhost:12345
Username: ChokerJokerCpp
Threads: 8
[RECV] HELLO~server
[SEND] LOGIN~ChokerJokerCpp
Logged in as ChokerJokerCpp
Joined queue, waiting for opponent...
[RECV] NEWGAME~ChokerJokerCpp~Opponent
Game started vs Opponent. I am player1.
AI first move: piece 7
[SEND] MOVE~7
[RECV] MOVE~3~5
AI: sq=0 piece=2 score=-4 nodes=12345 time=150ms (remaining=119850ms)
[SEND] MOVE~0~2
- Use
--threadsequal to the number of physical cores (not hyperthreads) - The AI auto-requeues after each game, so it plays continuously
- If username is taken, the client exits — pick a unique name
- The binary is ~54KB and starts instantly (no warmup needed)
The network code uses POSIX sockets, so it doesn't compile natively on Windows. Use WSL (Windows Subsystem for Linux):
# In WSL terminal
sudo apt install cmake g++
cd quarto-cpp
./build_release.sh
./build_release/quarto-ai --host <server-ip> --port 12345 --username Bot1