GP di Fortezza, Seria semplice più difficile (parere di Codex, simulato): sopra il limite in curva si esce di sicuro, la curva pulita dà una spinta, rivali a 0,81; CURVA! e LASCIA! sopra il motorino (Andrea)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GiECd9KMfjthRUnujCGSzZ
This commit is contained in:
+28
-1
@@ -1,6 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { SIMPLE, simple, simpleLimit, SWIPE, setPower, newGara, update, press, presenting, INTRO, release, cancel, shoot, key, steerButton, brakeButton, aimScreen, steering, status, button, standings, player, rider, limitAt, pointAt, TRACK, CURVES, PICKUPS, BRAKE, VERGE, LAPS, COUNTDOWN, RIDERS } from '../src/engine/gara.js';
|
||||
import { SIMPLE, simple, simpleLimit, mustLift, PREAVVISO, SWIPE, setPower, newGara, update, press, presenting, INTRO, release, cancel, shoot, key, steerButton, brakeButton, aimScreen, steering, status, button, standings, player, rider, limitAt, pointAt, TRACK, CURVES, PICKUPS, BRAKE, VERGE, LAPS, COUNTDOWN, RIDERS } from '../src/engine/gara.js';
|
||||
import { piloti } from '../src/story/piloti.js';
|
||||
import { story } from '../src/story/story.js';
|
||||
import { Game } from '../src/engine/game.js';
|
||||
@@ -304,3 +304,30 @@ test('guida semplice: sempre a tutto gas si finisce nella paglia; mollando prima
|
||||
}
|
||||
assert.ok(SIMPLE.slide > 0);
|
||||
});
|
||||
|
||||
test('Seria semplice: chi non rallenta in curva va fuori e perde, chi frena giusto fa le curve pulite e vince; LASCIA! dice quando', () => {
|
||||
const riders = piloti.filter(p => p.consenso !== null);
|
||||
const wise = c => { const r = player(c), h = r.v * r.v / (2 * BRAKE) + 10; for (let d = 0; d <= h; d += 4) { const a = simpleLimit(r, r.s + d, c.tune); if (r.v * r.v > a * a + 2 * BRAKE * d) return false; } return true; };
|
||||
for (const seed of [1, 2]) {
|
||||
const wild = race(newGara(seed, { level: 'seria', riders }));
|
||||
run(wild, 120, () => true);
|
||||
const good = race(newGara(seed, { level: 'seria', riders }));
|
||||
run(good, 120, wise);
|
||||
assert.ok(wild.result.offs >= 4, `a tutto gas fuori in quasi ogni curva (${wild.result.offs})`);
|
||||
assert.ok(wild.result.place >= 3);
|
||||
assert.equal(good.result.offs, 0); assert.equal(good.result.winner, 'player', `seme ${seed}`);
|
||||
assert.ok(player(good).cleans >= 5, 'le curve pulite');
|
||||
assert.ok(wild.result.times.andrea - good.result.times.andrea > 6, 'tutto gas costa più di 6 secondi');
|
||||
}
|
||||
// Chi segue LASCIA! guida come chi frena giusto; CURVA! arriva prima.
|
||||
const c = race(newGara(1, { level: 'seria', riders }));
|
||||
let early = 0, said = false;
|
||||
for (let t = 0; t < 20; t += 1 / 60) {
|
||||
c.holding = !mustLift(c);
|
||||
if (mustLift(c, PREAVVISO) && !mustLift(c)) early++;
|
||||
update(c, 1 / 60);
|
||||
if (c.holding && mustLift(c)) said ||= /Lascia!/.test(status(c));
|
||||
}
|
||||
assert.ok(early > 20, `il preavviso CURVA! viene prima di LASCIA! (${early} fotogrammi)`);
|
||||
assert.ok(said, 'il pannello dice Lascia!');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user