Bunco Simulator

Update of "The Simulation Model"
Overview

Artifact ID: 44f2b182a3ee8ba19f1029ccf991a2ae5f0b6e1b989d8871e8f1d8f35c9f259c
Page Name:The Simulation Model
Date: 2018-11-28 01:42:32
Original User: joel
Mimetype:text/x-markdown
Content

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.