This article is about hosting a coding competition. If you want to participate, you will find all information you will need. The goal of this competition is a grand finale where everyone gets to fight.
Game rules
The game that’s played is called Connect6. These are the rules:
- Players and stones: There are two players. Black plays first, and White second. Each player plays with an appropriate color of stones.
- Game board: Connect6 is played on a square board made up of orthogonal lines, with each intersection capable of holding one stone. Our board will be 19×19.
- Game moves: Black plays first, putting one black stone on one intersection. Subsequently, White and Black take turns, placing two stones on two different unoccupied spaces each turn.
- Winner: The player who is the first to get six or more stones in a row (horizontally, vertically, or diagonally) wins.
We need to limit the response time so games won’t run forever. The server tells the KI in the beginning how much time a turn can take. However if only a portion of the time is needed the remaining time will be added to your next turn. Take a look at the protocol.
Every client runs in a docker container limited to 1 thread and 1GB RAM. The KI can consume these resources at will.
Development
To submit a KI you will be assigned to your own private repository. Your master/main branch will be checked out and build for test matches. The following programming languages/build tools will be supported:
- Python 3.9
- C++/C/(C)Make
- Rust/Cargo
- Java/Ant
- C# (.NET Core/5)
- GOLang
The KI can use different approaches on calculating the best move. However bear in mind you will run on a CPU!
Also we expect you to develop your own code and not use huge libraries which defeat the purpose of this competition.
For all competitions you should also provide some console parameters which we need to configure your KI.
-p which configures the port the your KI connects to
-i which configures the IP the KI connects to
-k provides you the login key your KI uses to connect to the server
Matchmaking
To have a fair competition everyone plays against everyone else. The winning KI will be awarded three point, a draw will result in one point each, and a looser will gain zero points. A disqualified KI will loose one point 🙁
The KI can be disqualified due to four reasons
- The automatic build / execution on Linux fails
- Sending malformed messages
- Exceeding the time limit
- Disconnecting before the game ends
Protocol
Because multiple teams will develop their own project we need to make some commitments to a standard of communication. All communication between the server and your client will be done using basic TCP traffic (no http, no rest api). During the game the server is the single point of truth to eliminate cheating.
The first byte of a message is the ID. Also keep in mind all network traffic is MSB (most significant bit) and big endian.
Client connects to server | Contents | ID |
Client makes login to server | 8bit: login key provided by transferred parameters | 0 |
Server answers with game information | 8bit: color (black: 0, white: 1) | 1 |
Server send turn request | 32bit: (updated) remaining computation time (in ms) | 2 |
Client send turn answer | 8bit: x1 (0…18) 8bit: y1 (0…18) 8bit: x2 (0…18) 8bit: y2 (0…18) | 3 |
Server broadcasts turn answer | 8bit: x1 (0…18) 8bit: y1 (0…18) 8bit: x2 (0…18) 8bit: y2 (0…18) 8bit: color (black: 0, white: 1) | 4 |
Server broadcasts game end | 8bit: winner color (black: 0, white: 1, draw: 2) | 5 |
After the message with ID 5 is received the client must disconnect and terminate.
Take a look at this example of a message with ID 4:
ID | X (16) | Y (8) | X2 (17) | Y2 (9) | Color (white) |
0000 0100 | 0001 0000 | 0000 1000 | 0001 0001 | 0000 1001 | 0000 0001 |
Or at this example of a message with ID 2 and 525.262s:
ID | Upper time byte | Upper mid time byte | Lower mid time byte | Lower time byte |
0000 0010 | 0000 0000 | 0000 1000 | 0000 0011 | 1100 1110 |
Final Countdown
The coding challenge will end on 31.07.2021 12:00! Right after that, the great competition will be hosted (so changes made after that will not affect your end result!). Also, at this time your master/main branch will be checked out and build.
Hallo,
mal ne Frage. Ist es möglich seinen Code gegen einen Server zu testen, damit man grundlegend weiß, ob es funktioniert? Also das Verbinden und der generelle Ablauf?
Auf jeden Fall ne coole Idee 😀