tttm is a game of tic-tac-toe played between APIs that players implement themselves.
- Players can use whatever language and whatever technology.
- The player must submit the URL to a server via the PR request on this repository. All player servers are listed in players.yml.
- The player can submit as many servers as he or she wants.
- The server needs to follow the Player Server Protocol described in this document.
- The game server will randomly pick player servers and execute gameplay.
- Games will be played every hour. Each server will play 100 games every hour.
- The server needs to respond in 3 seconds. Otherwise, the opposing server wins.
TBD: Scoring
Players need to implement an HTTP server that needs to have one endpoint.
The game server will pass the following URL query parameters
to the player server.
gid
-UUID
that represents the given game ID.- It can be used on player servers to stick together individual games.
size
- A number - size - of tic-tac-toe grid.- By default, the size is set to
3
, representing the grid of size3x3
. To win, one has to have 3 symbols in either row/column/diagonal. ⚠️ Thetttm
engine currently only supports a size of 3. We will expand this to5x5
and7x7
, where one must put four symbols to win.
- By default, the size is set to
playing
- A symbol that the player server needs to play. Possible values areX
orO
moves
- A string that represents the previous moves.- Moves are separated by
_
and positions by-
- Example:
X-1-1_O-0-0
means that theX
symbol was at location1,1
(centre of grid) andO
at0,0
(top-left corner of the grid)
- Moves are separated by
The content of the successful response (HTTP status 200) needs to be a string that should have the following structure:
Move:X-2-2
The player server replied by placing the symbol X
in position 2,2
in the grid—in this case, the very bottom right.
If, for some reason, the server is unable to reply or parse, please use the following payload structure:
Error:Sorry. Can't do it bro.
- tttm-randy is a sample player server implemented in Python 3 with Flask and uses "random strategy" where it will "play" any field that is empty on the given grid.
Why not? We want to see who can build the universe's fastest and most "intelligent" APIs for the lolz.
This project uses devenv for development. Once you have the dependencies; you can just use sbt.
sbt test
Build local Docker image:
sbt docker:publishLocal
docker run -ti --rm -p 7777:7777 ghcr.io/ogrodje/tttm -- server -P 7777
docker run --rm ghcr.io/ogrodje/tttm -- --help