Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/perkzen/tttm-mango
https://github.com/perkzen/tttm-mango
go minimax-algorithm
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/perkzen/tttm-mango
- Owner: perkzen
- Created: 2024-10-03T20:33:08.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-16T09:49:49.000Z (2 months ago)
- Last Synced: 2024-10-25T03:42:42.739Z (2 months ago)
- Topics: go, minimax-algorithm
- Language: Go
- Homepage: https://mango.perkz.cloud/
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tttm-mango
## Description
[tttm-mango](https://github.com/perkzen/tttm-mango) is a minmax player server for
the [tttm](https://github.com/ogrodje/tttm) tic-tac-toe challenge.## Usage
```bash
# install dependencies
go mod download
# run the server
go run cmd/server/main.go
# or
make run
```## Player Server Protocol
Players need to implement an HTTP server that needs to have one endpoint.
### `GET /move`
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 size `3x3`. To win, one has to have 3 symbols in
either row/column/diagonal.
- `playing` - A symbol that the player server needs to play. Possible values are `X` or `O`
- `moves` - A string that represents the previous moves.
- Moves are separated by `_` and positions by `-`
- Example: `X-1-1_O-0-0` means that the `X` symbol was at location `1,1` (centre of grid) and `O` at `0,0` (top-left
corner of the grid)### Body
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.
```