Mazer is a simple dungeon-escape game. You are trapped in a 2×2 grid. Find the exit to escape! This project contains example of AI Agent to play the game by itself (currently it support Gemini AI).
col 0 col 1
┌──────────┬──────────┐
r1 │ OPEN │ EXIT 🚪 │ ← reach EXIT to win
├──────────┼──────────┤
r0 │ START ⚑ │ WALL 🧱 │ ← you always begin here (0,0)
└──────────┴──────────┘
- Coordinates:
(x=col, y=row)—yincreases going up. - You start at
(0, 0). - The exit is at
(1, 1). - Winning path: UP → RIGHT (2 moves)
- Register —
POST /userswith a name → you get auser_id. - Start a game —
POST /startwith youruser_id→ you get asession_id. - Move —
POST /game/{session_id}/movewith a direction (up,down,left,right). - Repeat until you win or get blocked by a wall.
-
Run the services with command:
./app.sh runorGOOGLE_API_KEY="xxx" ./app.sh run --with-agentif you want to run the AI-Agent in parallel. -
Open:
http://localhost:8000/uifor the UIhttp://localhost:8000/docsfor the Swagger UIhttp://localhost:8000/openapi.jsonfor the OpenAPI specificationhttp://localhost:8501for the Gemini Agent
./app.sh test
| Method | Path | Description |
|---|---|---|
GET |
/ui |
Game UI (HTML interface) |
POST |
/users |
Register a new player (returns id) |
GET |
/users |
List all players |
DELETE |
/users/{user_id} |
Delete a player and all their sessions |
POST |
/start |
Start a new game session (requires user_id, returns session_id) |
POST |
/game/{session_id}/move |
Make a move: up, down, left, right |
POST |
/game/{session_id}/reset |
Reset a finished/abandoned session back to the start |
GET |
/game/{session_id} |
Get current state + full move history |
GET |
/games |
List all sessions |
DELETE |
/game/{session_id} |
Abandon a session |
result |
Meaning |
|---|---|
moved |
Successfully stepped to a new cell |
blocked |
Wall or boundary — position unchanged |
won |
Reached the exit — game complete |
status |
Meaning |
|---|---|
active |
Game in progress |
won |
Player reached the exit |
abandoned |
Player called DELETE |
Why separate users and sessions?
A user is your permanent account (just an id + name). A game session is one play-through. You can start many sessions with the same user and compare runs. Deleting a user also removes all their sessions. Two sessions can't use the same session simultaneously — moves are locked at the database row level to prevent race conditions from parallel requests.


