shipwithjev

Catalog / Games & real time

0348GitHub

typesafe-snake

Snake autoplayer with one typed decision per tick and code-generated legal moves.

sorrycc/typesafe-snakeREADME ↗
# jev plays snake

TypeSafe's Jev (a System One decision model, not an LLM) plays Snake in real time.
Code generates the legal moves and exact facts about each one (food distance, reachable
cells via flood fill, dead ends); Jev picks one with a single `choice` question per step.
If the answer misses the tick deadline, the snake just keeps going straight.

## Run

```sh
cp .env.example .env   # set TYPESAFE_API_KEY
pnpm install
pnpm dev               # web http://localhost:5188, proxy http://127.0.0.1:8787
```

The API key lives only in the Hono proxy (`server/index.ts`); the browser calls `/api/decide`.

## Layout

- `src/game/engine.ts` – pure snake engine (seeded RNG)
- `src/game/analysis.ts` – legal moves, flood fill, dead-end detection, fallback move
- `src/game/controller.ts` – fixed-clock loop: ask Jev at tick start, play what arrived at tick end
- `src/jev/prompt.ts` – state + choice question sent to Jev, strategy presets
- `server/index.ts` – `POST /api/decide` via `@typesafe-ai/sdk`
- `src/components/` – dark dashboard UI: `Board` (canvas, interpolates the snake between ticks), `StrategyBar`, `StatusCard`, `CurrentDecision`, `DecisionFeed`

`pnpm test` runs the engine and controller tests, `pnpm typecheck` runs tsc.

Also filed under Games & real time

  1. 0607

    2048Jev: Jev plays 2048

    Built a demonstration of Jev playing 2048. Note: It might not always win. :)

    @TheRealRajdeep · Games & real time

  2. 0603

    System 1 Speedcuber: a Rubik's cube agent

    A speedcubing agent built on Jev and Laya ModernBERT-421M, with real-time 3D state, temporal memory and calibrated move probabilities instead of a solver.

    @harsha_varma02 · Games & real time

  3. 0597

    Astra and Jev play Minecraft

    A video letting Astra plan and Jev act inside Minecraft, with an outcome the creator didn't expect.

    @MatinSenPai · Games & real time

  4. 0593

    Jev Kitchen

    Inspired by @heystefan_: name a dish or a cocktail, and its ingredients rise out of a pile of stickers. ⚡ Jev judges every search in half a second 🎨 ~1,000 illustrations by FLUX.1 [dev], run locally through ComfyUI 🧠 Claude Opus 5.5 built it all and redrew the illustrations

    @nelsonpklark · Games & real time