Skip to content

snake-jev

Desktop Snake where one Jev call per tick asks nine hazard and food questions for left, straight and right, and Python combines them.

ServiceprototypeMIT

Overview

Snake Jev is a desktop Snake experiment built on an existing p5 Snake game. Each tick, the game's sensors are converted into distances relative to the snake's heading, and one API call asks nine independent questions: wall collision, body collision and food progress for turning left, going straight and turning right. Python combines only Jev's answers, preferring food progress among actions Jev assesses as collision-free, and otherwise choosing the lowest assessed collision risk, with ties favouring lower risk and then straight.

There is no second call and no model move Choice, and code does not inspect the board to correct Jev, so a wrong assessment can kill the snake. One recorded run reached 29 foods in 461 ticks before trapping itself; the README stresses that is one run, not a reliability guarantee, and that the agent detects immediate hazards but does not plan routes. Each tick costs a real request, so a --max-calls flag bounds sessions, and redacted traces are written locally.

What the decision model decides

TypeQuestionAnswers
Yes / noWould turning left / going straight / turning right hit a wall?—
Yes / noWould this move hit the snake's body?—
Yes / noDoes this move make progress toward the food?—

How it works

  1. Sample sensors and convert to relative distances
  2. Ask nine Noul questions in one call
  3. Combine answers: food progress among safe moves, else lowest risk
  4. Apply the move and advance one tick

Strengths

  • One call per tick
  • Simple, inspectable composition rule
  • Bounded sessions with --max-calls

Caveats

  • No route planning; can trap itself
  • Each tick costs an API call
  • Tested only on macOS

Getting started

git clone https://github.com/siroccomask/snake-jev.git && cd snake-jev && uv sync, set JEV_API_KEY in .env, then uv run python sketch.py.

At a glance

Type
Service
Status
prototype
Language
Python
Runtime
Desktop game (OpenGL)
Has code
yes
License
MIT

Use cases and integrations

How curated lists describe it

Frequently asked questions

What does Jev decide?

Whether each of three moves hits a wall or body and whether it approaches food.

How well does it play?

One recorded run reached 29 foods in 461 ticks before trapping itself.

Can I limit cost?

Yes, --max-calls bounds the session.

Related projects

  • Source for browser chess and Chess960 where code computes each legal move's facts and Jev picks one per turn as a typed Choice.

    ProjectproductionTypeScript
  • Browser 1v1 sniper arena where Jev reads match state about 9 times a second and chooses movement, aim, ADS, firing and jumping.

    ServicebetaTypeScript
  • Instrumented 2048 web lab where every move is a Jev Choice over four directions, with probabilities, latency and cost shown live.

    ProjectbetaTypeScript
  • Fifteen live arcade games where Jev and LLMs play each other, led by WikiRace in which Jev picks only real links.

    ProjectbetaTypeScript
  • Real-time bot battles where you write a fighter's strategy in plain English and a System One model pilots it several times a second.

    ProjectbetaTypeScript
  • Browser extension that lets Jev, local Laya or an OpenAI-compatible model take over a running ra2web (WannaFire) RTS match.

    ProjectbetaTypeScript