A framework for presenting coding challenges where participants implement algorithms to solve the same problem. The problem should be one where multiple algorithms compete with each other at the same time.
- Gather a bunch of happy coders in a small room
- Set up a server connected to a TV-screen to show the battle-grounds
- Provide a link and explain the challenge to the participants.
Prerequisites: rust
- Clone this repo
- cargo run --list-games
- cargo run --game spy-master # For example
- A UI should pop up, place it on a screen visible to all participants
Start from scratch, or use one of the sample starters below.
For the participants, every challenge has roughly the same structure.
- Connect to the server (The host should have provided you with IP:port)
- Provide a username (See authentication message below)
- ╭─╭─ The server will send the state of the world your turn
- | | The client will answer with their next move player moves
- | ╰─ Repeat from step 3
- | The server will announce a winner when the game is over game ends
- ╰─ Repeat from step 3
For specifics on your particular game, go to the game-specific section here:
The client should connect through ordinary TCP connection, and exchange message using JSON-format, each one terminated by a newline. The content of the JSON message can not contain a newline.
First message that is sent upon client connection.
The password below is set the first time you connect, and you should reuse the same username/password connection on every connection after that.
Server -> Client
{"auth":
{"username": "your_name",
"password": "your_password"
}}
Game state below will be different for each game. See the details in the README for the specific game you're playing.
Server -> Client
{"your-turn": {game_state}}
Player move below will be different for each game. See the details in the README for the specific game you're playing.
Client -> Server
{"move": {player_move}}
After the game over message has been sent, a new round will immediately begin.
Server -> Client
{"game-over":
{"reason": "winner <username>"|"draw"}}
In case the server receives input that it can not understand, or is invalid, the client will be sent an error message, and immediately disconnected.
Server -> Client
{"error":
{"reason": "invalid move"|"invalid message format"|"wrong password"}}