游戏与仿真

jev_speedway

@bchaney1JavaScript更新于 2026-09-19可当场跑

使用 jev 控制虚拟赛道上的赛车。

英文原文

Uses jev to control race cars on a virtual track

bchaney/jev_speedway

它在哪儿调用了 Jev

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

lib/jev.mjs:14

链接指向我们抓取当天的那个 commit,行号是准的。

它问 Jev 的问题

下面是从这个项目源码里原样取出来的 question 组合。

取自 public/world.mjs:84

  1. line选项

    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. pace选项

    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. overtake是/否

    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. boost是/否

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

用你自己的内容跑一遍

代码
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`?' },
  },
});

同类的其他项目