Carte che volano: dalla mano al tavolo e, finita la presa, sul mucchietto di chi ha preso (briscola, tressette, scopa; Andrea: «non si capisce quando vengono buttate le carte»). Il valzer della balera ai tavoli da carte (tools/valzer_carte.py: fisarmonica musette, basso, melodia di mandolino col tremolo), musica per primo piano; video «Come si gioca»: cache del Chromium della VM spenta, narratore e personaggi a turno, musica di sottofondo, pronunce del narratore
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1dxvtsZx8NE9fwjXUNDBr
This commit is contained in:
+7
-3
@@ -5,6 +5,9 @@ import { DECKS, cardName } from './briscola.js';
|
||||
export { cardName };
|
||||
export const LEVELS = ['bona', 'seria', 'male'];
|
||||
export const TARGET = 11;
|
||||
// I tempi delle animazioni (scopa-render.js): la carta vola dalla mano; le carte prese restano ferme un attimo e poi
|
||||
// volano sul mucchietto di chi ha preso.
|
||||
export const PLAY_TIME = 0.3, TAKE_HOLD = 0.75, TAKE_TIME = 1.35;
|
||||
export const COIN = { toscane: 'mattoni', napoletane: 'denari' };
|
||||
// Valore per le prese: Asso 1, poi i numeri, figure 8, 9 e 10. Primiera: 7 vale 21, 6 18, Asso 16, 5 15, 4 14,
|
||||
// 3 13, 2 12, le figure 10.
|
||||
@@ -105,7 +108,7 @@ export function take(c, k = c.choice?.selected) {
|
||||
export function cancel(c) { if (c.step !== 'choose') return false; c.step = 'play'; c.choice = null; return true; }
|
||||
function execute(c, who, index, captured) {
|
||||
if (!captured && captures(c.table, c.hands[who][index]).length) return false;
|
||||
const [card] = c.hands[who].splice(index, 1);
|
||||
const before = [...c.table], [card] = c.hands[who].splice(index, 1);
|
||||
if (captured) {
|
||||
const ids = new Set(captured.map(a => a.id));
|
||||
c.table = c.table.filter(a => !ids.has(a.id)); c.taken[who].push(card, ...captured); c.lastTaker = who;
|
||||
@@ -114,7 +117,8 @@ function execute(c, who, index, captured) {
|
||||
const lastPlay = !c.stock.length && !c.hands.player.length && !c.hands.cpu.length;
|
||||
const scopa = !!captured && !c.table.length && !lastPlay;
|
||||
if (scopa) c.scope[who]++;
|
||||
c.last = { who, card, captured: captured ?? [], scopa };
|
||||
// `from` e `before` servono al disegno: da dove parte la carta e com'era la tavola prima della presa.
|
||||
c.last = { who, card, captured: captured ?? [], scopa, from: index, before };
|
||||
c.events.push({ kind: captured ? 'card-tap' : 'card-slide', who }, ...(scopa ? [{ kind: 'card-busso', who }] : []));
|
||||
c.step = 'take'; c.t = 0;
|
||||
if (who === 'player') c.selected = Math.min(c.selected, Math.max(0, c.hands.player.length - 1));
|
||||
@@ -230,7 +234,7 @@ export function choose(v, level = 'seria', seed = 1) {
|
||||
export function update(c, dt) {
|
||||
if (!Number.isFinite(dt) || dt < 0 || c.step === 'result') return;
|
||||
c.t += dt;
|
||||
if (c.step === 'take' && c.t >= (c.last.captured.length ? 1.3 : 0.6)) after(c);
|
||||
if (c.step === 'take' && c.t >= (c.last.captured.length ? TAKE_TIME : PLAY_TIME * 2)) after(c);
|
||||
else if (c.step === 'play' && c.current === 'cpu' && c.t >= 0.75) {
|
||||
c.aiSeed = lcg(c.aiSeed);
|
||||
const m = choose(observation(c, 'cpu'), c.level, c.aiSeed);
|
||||
|
||||
Reference in New Issue
Block a user