Checker Game
Introduction
This is a chinese checkers program written in cpp, where the program itself is devided into two parts:
Server
Server holds the board of the game, executing clients for next thier move.\
Client
Client reads the board and outputs its results with file IO
I/O
Server will dump board.txt
each time before executing a client.
It is a 17x17 array looks something like this:
0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0
0 0 0 0 0 0 0 0 0 0 2 2 2 0 0 0 0
0 0 0 0 0 0 0 0 0 2 2 2 2 0 0 0 0
0 0 0 0 1 1 1 1 2 2 2 2 2 1 1 1 1
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0
0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0
0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0
0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0
0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
1 1 1 1 3 3 3 3 3 1 1 1 1 0 0 0 0
0 0 0 0 3 3 3 3 0 0 0 0 0 0 0 0 0
0 0 0 0 3 3 3 0 0 0 0 0 0 0 0 0 0
0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0
where 0 is void, 1 is empty spaces, 2 and above are different colors of checkers.
Client will reads this text file in, then outputs another text file with the same filename as your executable.
First line of the output should have one number
Then the next
Usage
Use server.cpp like:
.\server.exe <AI1> <AI2>
Both AI.exes should be kept within the same folder
Server will call AI#.exe with <AI#>.exe <player_num>
Where player_num is the number that indicates the player on chess board
In each round, player should read inputs from board.txt
and outputs to AI#.txt
Server will execute client like:
.\s1072026.exe 3
client should read from board.txt
and outputs its move to s1072026.txt
within a minute.
For a short demo
g++ baseAI.cpp -o baseAI1
g++ baseAI.cpp -o baseAI2
g++ server.cpp -o server
.\server baseAI1 baseAI2
c88tm:3
Iotalh:3333333333333