Biliardo dell'Ing. Tozzi: il tiro pieno va più forte (720 cm/s; i rinquarti restano a 520) e il test nel browser segue i comandi nuovi (Andrea)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GiECdCPptNRwbVzjzHbohi
This commit is contained in:
@@ -128,11 +128,13 @@ try {
|
||||
const fixed = (await state()).angle;
|
||||
await page.mouse.move(target.r.x + target.r.width * 0.55, target.r.y + target.r.height * 0.8, { steps: 8 });
|
||||
assert.equal((await state()).angle, fixed, 'spostarsi verso Tira non deve cambiare la mira');
|
||||
// Le frecce girano finché sono giù (sempre più svelte); un colpo secco è un passo, con Maiusc un passo fine.
|
||||
await page.keyboard.press('ArrowRight');
|
||||
const nudged = (await state()).angle;
|
||||
assert.ok(Math.abs(nudged - fixed - 0.002) < 1e-10);
|
||||
assert.ok(nudged - fixed >= 0.03 - 1e-9 && nudged - fixed < 0.1, `passo: ${nudged - fixed}`);
|
||||
await page.keyboard.press('Shift+ArrowLeft');
|
||||
assert.ok(Math.abs((await state()).angle - nudged + 0.0005) < 1e-10);
|
||||
const fine = nudged - (await state()).angle;
|
||||
assert.ok(fine >= 0.0005 - 1e-9 && fine < 0.01, `passo fine: ${fine}`);
|
||||
await page.locator('#bocce-power').fill('60');
|
||||
const prepared = await state();
|
||||
await page.screenshot({ path: `${out}/${name}-mira.png` });
|
||||
@@ -158,7 +160,8 @@ try {
|
||||
const cdp = mobile ? await page.context().newCDPSession(page) : null;
|
||||
if (mobile) await cdp.send('Input.dispatchTouchEvent', { type: 'touchStart', touchPoints: [{ x: hold.x, y: hold.y }] });
|
||||
else { await page.mouse.move(hold.x, hold.y); await page.mouse.down(); }
|
||||
await page.waitForFunction(() => game.closeup.holding && game.closeup.power > 0.25);
|
||||
// Si tiene premuto: dopo LONG_PRESS la stecca comincia a caricare.
|
||||
await page.waitForFunction(() => game.closeup.holding && game.closeup.charging);
|
||||
const heldAngle = (await state()).angle;
|
||||
if (mobile) await cdp.send('Input.dispatchTouchEvent', { type: 'touchMove', touchPoints: [{ x: hold.x - 30, y: hold.y + 20 }] });
|
||||
else await page.mouse.move(hold.x - 30, hold.y + 20, { steps: 4 });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { newBiliardo, update, press, release, cancel, setPower, shoot, judge, value, reach, speedFor, predict, castle, aimAt, aimScreen, nudge, canThrow, collide, simulate, LEN, WID, R, VIEW, SWING, powerAt, FIXED_STEP, CUSHION, WINDUP } from '../src/engine/biliardo.js';
|
||||
import { newBiliardo, update, press, release, cancel, setPower, shoot, judge, value, reach, speedFor, predict, castle, aimAt, aimScreen, nudge, canThrow, collide, simulate, LEN, WID, R, VIEW, SWING, powerAt, FIXED_STEP, CUSHION, WINDUP, STRONG } from '../src/engine/biliardo.js';
|
||||
import { story } from '../src/story/story.js';
|
||||
import { Game } from '../src/engine/game.js';
|
||||
import { settle } from './helpers.mjs';
|
||||
@@ -34,6 +34,9 @@ test('la forza: sale finché si tiene premuto; a metà la biglia fa circa un tav
|
||||
assert.ok(reach(speedFor(0.5)) > LEN * 0.9 && reach(speedFor(0.5)) < LEN * 1.3, `a metà forza: ${reach(speedFor(0.5)).toFixed(0)} cm`);
|
||||
assert.ok(reach(speedFor(1)) > LEN * 2);
|
||||
assert.ok(reach(speedFor(0)) < 30, 'piano piano si sposta appena');
|
||||
// All'Ing. Tozzi il tiro pieno va più forte (Andrea, 29 ottobre); i rinquarti restano alla forza di prima.
|
||||
assert.ok(reach(speedFor(1, STRONG)) > reach(speedFor(1)) * 1.3);
|
||||
assert.equal(newBiliardo(1).maxSpeed, STRONG);
|
||||
});
|
||||
|
||||
test('un colpo dritto sulla biglia avversaria la manda avanti, poi tocca all\'altro', () => {
|
||||
@@ -126,14 +129,14 @@ test('la guida e il tiro finiscono nello stesso punto, anche dopo sponde oblique
|
||||
const end = p.points.at(-1);
|
||||
shoot(c); roll(c);
|
||||
near(c.balls.player.x, end[0]); near(c.balls.player.y, end[1]);
|
||||
if (angle === 0) near(c.balls.player.x - x, reach(speedFor(power)), 0.01);
|
||||
if (angle === 0) near(c.balls.player.x - x, reach(speedFor(power, c.maxSpeed)), 0.01);
|
||||
}
|
||||
});
|
||||
|
||||
test('la sponda smorza la componente normale: anche la guida cambia angolo al rimbalzo', () => {
|
||||
const c = emptyTable();
|
||||
Object.assign(c.balls.player, { x: 270, y: 30 });
|
||||
c.angle = Math.PI / 4; c.power = 0.3;
|
||||
c.angle = Math.PI / 4; c.power = 0.2; // la stessa velocità di 0,3 prima del tiro più forte
|
||||
const p = predict(c), [start, rail, end] = p.points;
|
||||
assert.equal(p.points.length, 3);
|
||||
near(rail[0], LEN - R);
|
||||
|
||||
Reference in New Issue
Block a user