# Tank Tactics ## Operations All operations on a game will cause the server to distribute tokens if needed ### GET `/games` Return list of current games ```javascript { games: [{ id: "string", name: "string", }], } ``` ### PUT `/game` Create a new game with a given name ```javascript { name: "string", width: 0, height: 0, } ``` Returns ID ```javascript { id: "string", name: "string", } ``` ### GET `/game/{id}` Get a game with a given id ```javascript { name: "string", // display name of the game state: "LOBBY" || "PLAYING" || "FINISHED", width: 0, // board dimensions height: 0, distribute: "string", // next time points will be distributed players: { [code]: { // keyed by a player code string name: "string", // user-defined tank: null || { // null if jury x: 0, y: 0, points: 1, health: 3, range: 1, }, vote: null || "string", // code of current jury vote } } } ``` ### POST `/game/{id}/join` Join a game ```javascript { name: "string", } ``` Returns player code ```javascript { code: "string", } ``` ### POST `/game/{id}/start` Start a game, game must be in `LOBBY` state ### POST `/game/{id}/{fire,move,give}/{code}` Fire on, move to, or give to a target, game must be in `PLAYING` state ```javascript { x: 0, y: 0, } ``` Returns ```javascript { result: true, reason: "string" || null, // reason for failure if applicable } ``` ### POST `/game/{id}/upgrade/{code}` Upgrade the range of a tank, game must be in `PLAYING` state Returns ```javascript { result: true, reason: "string" || null, // reason for failure if applicable } ``` ### POST `/game/{id}/vote/{code}` Set a jury vote, game must be in `PLAYING` state ```javascript { vote: "string" || null, } ```