Skip to content
System One

laya-pong

A browser pong game whose left paddle is decided by one Laya choice question per frame, 18.7ms p50 on Metal, while the right paddle plays fixed arithmetic for comparison.

aovestdipaperino/laya-pong on GitHub

Stars
3
Forks
0
Language
Rust
Last push
20 Sep 2026

Read from GitHub on . Counts change daily.

How it uses Jev

async fn decide(State(ctx): State<Arc<Ctx>>, Json(ask): Json<Ask>) -> Json<Decision> {
    let t = Instant::now();
    // The model is CPU/GPU-bound and holds no async state, so it runs on the
    // blocking pool rather than stalling a Tokio worker for 20 ms a frame.
    let ctx2 = Arc::clone(&ctx);
    let out = tokio::task::spawn_blocking(move || {
        ctx2.agent.system_one(&json!(ask.state), &ctx2.questions)
    })
    .await;

    let (mv, confidence) = match out {
        Ok(Ok(r)) => {
            let a = &r.answers["move"];
            let mv = match a["choice"].as_str() {
                Some(c) if c.contains("up") => -1,

View in server/src/main.rs

Open on GitHub

PrimitivesChoice

More like this

Use cases this is tagged with