frontendove optimalizacie
This commit is contained in:
@@ -12,3 +12,12 @@ export function computePlayable(hand: Hand, ledColor: CardColor | null): Set<str
|
||||
|
||||
return new Set(keys);
|
||||
}
|
||||
|
||||
/** The bid the last guesser may not make: the four bids must not sum to the
|
||||
* number of tricks in the round (mirrors Round.add_player_guess in the engine).
|
||||
* Returns null while earlier players are still guessing. */
|
||||
export function forbiddenGuess(cardsInRound: number, guesses: Record<string, number>): number | null {
|
||||
if (Object.keys(guesses).length !== 3) return null;
|
||||
const alreadySum = Object.values(guesses).reduce((a, b) => a + b, 0);
|
||||
return cardsInRound - alreadySum;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user