Local Development
In addition to the web api, we have a locally hosted version available.
Installation and Running
Install Docker Desktop, or Engine if you prefer a command line interface only.
Execute the following command:
docker run -p 3000:3000 longhousedev/localapi
This will start the api and make the it listen on port 3000.
- If that port is not available to use, you can change it like so:
docker run -p 1234:3000 longhosedev/localapi
This will make the api listen on port 1234, you can change this to any port which works for you.
The local version of the API does not need a queuing system (since you will be the only one using it), thefore, there is only one API call required to use it, submit_run.
This API call will run a specific game configuration in TAG. It requires a valid game, and set of game parameters. If sucesfull it will return the score achieved by the chosen parameters
Run Type
Each run has a type, which determines how many matchups are played:
- fast: 36 matchups
- medium: 360 matchups
- full: 3600 matchups
Request
- URL: localhost:3000/api/run_game
- Method: POST
- Headers: All Required
- Content-Type: application/json
- Body: JSON (all required)
- game: String - The game to be played, valid strings are: Dominion, ExplodingKittens, Wonders7, CantStop
- params: JSON[String, String] - A map containg parameters and their chosen values
- run_type: String - String - The type of run this is, if not provided defaults to ‘fast’ see documentation for more information
Response
- Status:
- 200 OK: Request completed sucesfully
- 400 Bad Request: There was an issue with one of the provided parameters
- Body JSON
- error: (400) String - Describes why the request couldn’t be completed
- score: (200) Number - The score achieved by the chosen parameters
Example
Request
curl -i -X POST http://localhost:3000/api/run_game
-H "Content-Type: application/json"
-d '{"game": "Dominion", "params": {"HAND_SIZE": 3}, "run_type": "medium"}'
Response
HTTP/1.1 200 OK
access-control-allow-origin: *
content-length: 27
content-type: application/json
Date: Sat, 31 May 2025 12:37:09 GMT
Connection: keep-alive
Keep-Alive: timeout=5
{"score":893.7916634877523}