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:
@@ -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