D 2018-11-28T01:42:32.933 L The\sSimulation\sModel N text/x-markdown U joel W 2110 ## Variable Rolling Speed Bunco gameplay is completely devoid of strategy except for one general notion: to maximize your points, you need to roll as fast as possible. Everyone who plays learns this pretty quickly. A round ends when one of the teams at the head table hits 21 points, which could happen at any time. The faster you roll and score your points, the more points your team is likely to get before that bell rings. I tried to maintain this aspect of the gameplay in the simulator. The actions of rolling and scoring points don't all happen in one step. Instead, the player progresses in time through the phases of a) grabbing the dice, b) rolling the dice, and c) comprehending whether they scored any points. This progression is going to happen at different speeds for each roll. ## Tick Tock: A round in progress While a round in progress, the program calls the `tick()` function for each table. Each table in turn calls the `tick()` function for the currently active player. Each active player’s state is tracked in their `turn_progress` counter. * When this counter reaches `25`, the player has grabbed the dice. * When it reaches `50`, they have rolled the dice. The current die roll is stored in memory but the roll is not immediately scored. * Finally, when the counter reaches `75`, the player has understood and recorded their score. At the end of an active player’s `tick()` function, if the player has just concluded rolling and recording a score, the point value of the roll is returned. If the player still hasn't finished rolling, the function returns `-1`. The table’s `tick()` function looks at the results of the active player’s tick. If the result is `0` then it means the player rolled and got no points, so it changes the active player to the next person at the table. If the result is `1` or more, then it updates the current team's score and also records the updated score on the scorecard for the active player’s teammate. If the result is `-1` then nothing happens in the current tick: the active player is hasn’t finished anything yet. Z a8f047a2a4d05ea69acd859e30593170