Back to Learn Jev
Starter project 10 · Play & explore

Snake instinct

Build a tiny game where code owns physics and Jev chooses one legal move per tick.

Time
60–90 min
Level
Game loop
Shape
Board + legal moves → next-move choice → deterministic game tick
You’ll practice
Structured state · Legal actions · Replayability

The agent prompt

Copy this brief into your coding agent from the root of the project you want to build in. It names the behaviour, the constraints, and the checks to run — the decisions Jev makes stay explicit so you can see what the model actually decided.

Build a small "Snake instinct" game in this repository where Jev from TypeSafe AI controls the snake.

Inspect the existing project and use its framework and testing conventions. Use the official TypeSafe skill for current API usage; install it with npx skills add typesafe-ai/skills --skill typesafe-ai if absent.

Deterministic game code owns the board, collision rules, food, score, and legal moves. On each slow, user-triggered step, serialize compact state: head, body, food, direction, board size, and legal moves. Ask Jev a Choice question using only legal move IDs. Animate the chosen move and show its probabilities. Include manual play, Jev step, auto-play with a conservative rate limit, pause, reset, seeded boards, and a replay log.

Requirements:
- Keep TYPESAFE_API_KEY server-side.
- Never ask Jev to calculate collisions; legal actions come from code.
- Stop auto-play on API error, low confidence, loop detection, or tab backgrounding.
- Make the game fully playable with keyboard controls.
- Unit-test game rules independently and integration-test the model boundary with mocks.
- Document how structured state stays small.

Run checks and include one deterministic replay fixture in the handoff.

Built something like this

Community projects in the directory that solve a similar problem: