Games & simulation

jev_speedway

@bchaney1JavaScriptupdated 2026-09-19runnable

Uses jev to control race cars on a virtual track

bchaney/jev_speedway

Where it calls Jev

url: "https://api.typesafe.ai/v1/systemone",

lib/jev.mjs:14

The link points at the commit we read, so the line number still holds.

What it asks Jev

These question sets are lifted from this project's source exactly as written.

from public/world.mjs:84

  1. linechoice

    Which line should `driver` take through the next corner (see `track_ahead`), given `rivals`, `car.road_position` and the driver's `driver.traits`? Two cars in the same place make contact.

    • insideTight line, shortest distance, less forgiving if too fast
    • middleNeutral line
    • outsideWide line, more forgiving at speed, longer distance
  2. pacechoice

    How hard should `driver` push into `track_ahead.next`, given `car.situation`, `rivals` and `driver.traits`? The code brakes for corners at the chosen pace.

    • attackBrake as late as possible and carry speed past the grip limit: faster if it sticks, a real risk of spinning
    • steadyDrive at the limit, brake normally and stay in control
    • cautiousBrake early and protect the position, giving up some time
  3. overtaketrue/false

    Should `driver` attempt to pass `rivals.ahead` before `track_ahead.next`? Going for it pulls the car out to the open side of the rival and pushes harder; staying put means following in their wheel tracks.

  4. boosttrue/false

    Should `driver` use the boost right now, considering `driver.boost`, `track_ahead` and `rivals`?

Run it on your own text

The code
import { experimental_evaluate as evaluate } from 'ai';

const { answers } = await evaluate({
  model: 'typesafe-ai/jev',
  state,
  questions: {
    line: { type: 'choice', instructions: 'Which line should `driver` take through the next corner (see `track_ahead`), given `rivals`, `car.road_position` and the driver\'s `driver.traits`? Two cars in the same place make contact.',
      criteria: { inside: 'Tight line, shortest distance, less forgiving if too fast', middle: 'Neutral line', outside: 'Wide line, more forgiving at speed, longer distance' } },
    pace: { type: 'choice', instructions: 'How hard should `driver` push into `track_ahead.next`, given `car.situation`, `rivals` and `driver.traits`? The code brakes for corners at the chosen pace.',
      criteria: { attack: 'Brake as late as possible and carry speed past the grip limit: faster if it sticks, a real risk of spinning', steady: 'Drive at the limit, brake normally and stay in control', cautious: 'Brake early and protect the position, giving up some time' } },
    overtake: { type: 'boolean', instructions: 'Should `driver` attempt to pass `rivals.ahead` before `track_ahead.next`? Going for it pulls the car out to the open side of the rival and pushes harder; staying put means following in their wheel tracks.' },
    boost: { type: 'boolean', instructions: 'Should `driver` use the boost right now, considering `driver.boost`, `track_ahead` and `rivals`?' },
  },
});

Other projects in this category