CPSC 3750 Final Project - Phase 1
Distributed Multiplayer Battleship System
API v1.0/api/reset
Reset entire system (truncate all tables)
/api/players
Create new player with UUID
{ "username": "alice" }
/api/players/{id}/stats
Get player statistics (games, wins, losses, accuracy)
/api/games
Create new game (creator auto-joins with turn_order=0)
{ "creator_id": "uuid", "grid_size": 8, "max_players": 3 }
/api/games/{id}/join
Join existing game
{ "player_id": "uuid" }
/api/games/{id}
Get game state
/api/games/{id}/place
Place 3 ships (exactly 3 single-cell ships required)
{ "player_id": "uuid", "ships": [{"row": 0, "col": 0}, ...] }
/api/games/{id}/fire
Fire at coordinate (validates turn, checks hit/miss, updates stats)
{ "player_id": "uuid", "row": 3, "col": 4 }
/api/games/{id}/moves
Get chronological move history
/api/test/games/{id}/restart
Restart game (clear ships/moves, preserve stats)
/api/test/games/{id}/ships
Deterministic ship placement for testing
/api/test/games/{id}/board/{player_id}
Reveal board state (for autograder verification)
| Table | Purpose | Key Fields |
|---|---|---|
| Players | Player accounts with UUID | player_id (UUID), username, stats |
| Games | Game instances | game_id, grid_size, status, current_turn_index |
| GamePlayers | Many-to-many join table | game_id, player_id, turn_order, ships_placed |
| Ships | Ship positions | game_id, player_id, row, col, is_sunk |
| Moves | Move history log | game_id, player_id, target_player_id, result |