A cup of dice a player can keep and re-roll - Yahtzee's own mechanic, generalised to any count/sides.
import { DiceCup } from '@datamoc/mw_games/board';import { Random } from '@datamoc/mw_games/core';const cup = Random.withSeed(1, () => new DiceCup(5, 6));console.log(cup.values); // [5, 2, 6, 1, 1]cup.keep(2); // keep the 6cup.reRoll(); // every other die rolls again; index 2 stays a 6 Copy
import { DiceCup } from '@datamoc/mw_games/board';import { Random } from '@datamoc/mw_games/core';const cup = Random.withSeed(1, () => new DiceCup(5, 6));console.log(cup.values); // [5, 2, 6, 1, 1]cup.keep(2); // keep the 6cup.reRoll(); // every other die rolls again; index 2 stays a 6
Readonly
A cup of dice a player can keep and re-roll - Yahtzee's own mechanic, generalised to any count/sides.
Example