游戏与仿真

typesafe-mario

@fhshaik287Python更新于 2026-09-16可当场跑

一个基于TypeSafe和Jev的agent,通过结构化模拟器状态玩超级马里奥兄弟游戏。

英文原文

A TypeSafe/Jev agent that plays Super Mario Bros. from structured emulator state.

fhshaik/typesafe-mario

它在哪儿调用了 Jev

from typesafe_sdk import Choice, Noul, Score, TypeSafeClient

src/typesafe_mario/policy.py:29

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

它问 Jev 的问题

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

取自 src/typesafe_mario/policy.py:55

  1. next_action是/否

    question

  2. danger打分

    How dangerous is Mario's immediate situation?

    • 0Safe open movement
    • 1Potential obstacle or enemy soon
    • 2Immediate collision, fall, or enemy threat

用你自己的内容跑一遍

代码
import { experimental_evaluate as evaluate } from 'ai';

const { answers } = await evaluate({
  model: 'typesafe-ai/jev',
  state,
  questions: {
    next_action: { type: 'boolean', instructions: 'question' },
    danger: { type: 'score', instructions: 'How dangerous is Mario\'s immediate situation?',
      criteria: ['Safe open movement', 'Potential obstacle or enemy soon', 'Immediate collision, fall, or enemy threat'] },
  },
});

同类的其他项目