Build a bot to play Sushi Go against other players on a networked game server.
Sushi Go is a card-drafting game by Gamewright. Find the rules online or get a copy of the game!
- Python 3.10+ (no external packages needed), or
- Node.js 18+ (no npm dependencies needed)
# Python — plays the first card every turn
python python/first_card_bot.py <game_id> <your_name>
# Python — priority-based strategy
python python/sushi_go_client.py localhost 7878 <game_id> <your_name>
# JavaScript — priority-based strategy
node javascript/sushi_go_client.js localhost 7878 <game_id> <your_name>To join a game on someone else's laptop
python first_card_bot.py <ip_address> <port> <game_id> <your_name>Replace <game_id> with the game ID shown in the web UI or given to you by the tournament organizer.
First, load the server image from the LAN:
curl -O https://joes-macbook.tail10906.ts.net/sushi-go-test.tar && docker load < sushi-go-test.taror
curl -O http://joes-macbook.local:9090/sushi-go-test.tar && docker load < sushi-go-test.tarThen start it:
docker run -it -p 7878:7878 -p 8080:8080 sushi-go-test- Port 7878 — TCP game port (where your bot connects)
- Port 8080 — Web UI for creating games and spectating
Open http://localhost:8080 in a browser, create a game, then run your bot with the game ID.
The basic pattern every bot follows:
- Connect to the server via TCP
- Send
JOIN <game_id> <your_name> - Send
READY - Wait for messages in a loop
- When you receive
HAND, choose a card and sendPLAY <index> - Repeat until
GAME_END
See python/first_card_bot.py for a minimal working example (~30 lines of game logic).
The starter clients include a strategy function you can edit:
- Python:
choose_card(hand)insushi_go_client.py - JavaScript:
chooseCard(hand)insushi_go_client.js
The hand parameter is a list of card names (e.g., ["Tempura", "Salmon Nigiri", "Pudding"]). Return the index of the card you want to play.
Or, write your bot from scratch — all you need is a TCP socket and the protocol below.
When your bot joins a game, the server sends back a rejoin token in the WELCOME message:
WELCOME myGame 0 fG6miM0Ge9OnNyUTsARaSyX3ZUW8cqr8
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Save this! It's your lifeline.
If your bot crashes or loses its connection, you can reconnect and send REJOIN <token> instead of JOIN. This restores your session — you keep your seat, your cards, and your score. Other players won't even notice you disconnected.
- Save the token when you receive
WELCOME(the 4th field) - If you disconnect, open a new TCP connection
- Send
REJOIN <token>instead ofJOIN - Server responds with
REJOINED <game_id> <player_id>— you're back in - You'll receive the next
HANDmessage when it's your turn, just like normal
- Save the token to a file so your bot can read it on restart
- You do not need to send
READYagain after rejoining - The token is a random 32-character string unique to your seat in that game
- If the game has already ended,
REJOINwill return an error
# First connection
>>> JOIN myGame Alice
<<< WELCOME myGame 0 fG6miM0Ge9OnNyUTsARaSyX3ZUW8cqr8
>>> READY
<<< OK
<<< HAND 0:Tempura 1:Sashimi ...
>>> PLAY 0
<<< OK
# Connection drops...
# New connection
>>> REJOIN fG6miM0Ge9OnNyUTsARaSyX3ZUW8cqr8
<<< REJOINED myGame 0
<<< HAND 0:Dumpling 1:Pudding ... (game continues)
>>> PLAY 1
<<< OK
See PROTOCOL.md for the full protocol specification, including:
| You Send | Server Sends |
|---|---|
JOIN <game_id> <name> |
WELCOME <game_id> <id> <token> |
READY |
OK |
PLAY <index> |
OK |
CHOPSTICKS <i> <j> |
OK |
REJOIN <token> |
REJOINED <game_id> <id> |
HAND 0:Card 1:Card ... (your turn) |
|
PLAYED ... (turn results) |
|
ROUND_END ... / GAME_END ... |