e2e 41b finds the ball's bounces by its turning points instead of frames within a pixel of the ground: the ball lands at ~9 px per frame, so whether a drawn frame catches the landing depended on where it fell between two physics steps, and CI missed the first landing and read the second bounce as the first (#147)
game-maker / gate (push) Successful in 1m47s
game-maker / suite (push) Successful in 6m18s

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5 committed 2026-09-18 20:55:20 +02:00
1 parent 328f978d3c
commit d931e66f92
1 file changed
+8 -13
+8 -13
View File
@@ -182,20 +182,15 @@ export async function physics(t) {
samples.length > 100 && samples[0].crate < REST - 50 && last.every((y) => Math.abs(y - REST) < 1), samples.length > 100 && samples[0].crate < REST - 50 && last.every((y) => Math.abs(y - REST) < 1),
JSON.stringify({ frames: samples.length, first: samples[0], last: last.slice(-3), rest: REST }), JSON.stringify({ frames: samples.length, first: samples[0], last: last.slice(-3), rest: REST }),
); );
// The heights the ball climbs back to: the highest point between two landings. // The heights the ball climbs back to: every turn from rising to falling after the first landing.
// Turning points, not a threshold at the ground: the ball lands at ~9 px per frame, and whether a
// drawn frame comes within a pixel of the landing depends on where it falls between two steps.
const peaks = []; const peaks = [];
let landings = 0; let landed = false;
let down = false; for (let i = 1; i < samples.length - 1; i++) {
let top = Infinity; const [before, y, after] = [samples[i - 1].ball, samples[i].ball, samples[i + 1].ball];
for (const { ball } of samples) { if (y >= before && y > after) landed = true;
if (ball > REST - 1) { else if (landed && y <= before && y < after && REST - y > 2) peaks.push(REST - y);
if (!down && landings++ > 0 && Number.isFinite(top)) peaks.push(REST - top);
down = true;
top = Infinity;
} else {
down = false;
if (landings > 0) top = Math.min(top, ball);
}
} }
const drop = REST - Y; const drop = REST - Y;
check( check(