Design snake and ladders 00:00:00 Make a prediction You will split die generation from board movement, then test a deterministic landing and an exact-finish boundary. A token is on eight, the roll is three, and a ladder starts on eleven and ends on twenty-six. What square should the ordinary single-jump rule produce? Twenty-six. First use the roll to reach eleven, then resolve the jump defined for that landing square. Applying ladders to every square passed on the way would implement a different game. 00:00:33 Asha and Lee race to the arch Children race toward an arch painted on a board. A slide matters when a player lands on its marked start. Merely hopping over that square does not send them down it. Keep movement, optional jump resolution and turn rotation explicit. A test can feed the exact die value rather than depending on real randomness. Snake and ladders is a race over numbered squares. A die decides how far you go. Some squares send you up, some send you down. No player ever makes a choice. Everybody knows the game, so the conversation is about objects after one minute. Because it is easy, a design that is too big stands out at once. 00:01:16 Keep a turn reproducible A token starts on square eight and the die shows three. Move to eleven first. If eleven is the foot of a ladder to twenty-six, the token ends on twenty-six. Keep the die separate from the board's jump map. A test can supply the roll of three and assert the exact final square. Then advance to the next player under the chosen turn rules. Specify whether jumps chain and how overshooting the last square behaves before writing those cases. Give the game a die returning the same known value on demand. Move the player to the landing square, then follow the board's jump rule and determine whose turn comes next. Replaying the same inputs should reproduce the same squares; a hidden random roll makes failures difficult to reconstruct. 00:02:03 Exercise an endgame rule A player on ninety-eight rolls four when an exact final roll is required on a hundred-square board. The token stays put and the turn changes according to the agreed rules. A simple clamp to one hundred would incorrectly declare a winner. Under an exact-roll finish rule, four from square ninety-eight overshoots one hundred and the player stays put. Roll two instead and the player wins. A bounce-back variant would produce a different first result, so state the rule before treating either implementation as defective. With exact finishing required, clamping an overshoot to one hundred awards an incorrect win. State whether jumps chain and what an overshoot does. Inject a deterministic die for unit tests while retaining a random die for ordinary play. The board game framework mentioned in the chapter passes controlled randomness into a move and makes ending the turn a distinct event. That split is useful in this design. A recorded die result and a recorded turn decision can reproduce what happened to one player without asking a random generator for another result. 00:03:12 Try an interview follow-up How does turn order survive a player leaving? I keep a stable player list and a current index. Removing someone before the current player shifts that index back. If the current player leaves, the next player slides into the same position, with wraparound at the end. I also clear that player’s extra-turn streak and handle the case where only one player remains. A ladder ends on a square that also starts a snake. Does a turn follow one jump or keep chaining? Ask the interviewer, then encode the chosen rule in turn resolution. If chains are allowed, handle cycles in a malformed board. Test the same die roll under the agreed board layout. 00:03:58 What to take with you The board is a size and one map from start to end, checked when it is made and shared by all games. The die is handed in, the rules are frozen values, and the game alone owns order, positions, streak and log. take turn refuses, rolls, computes, changes, records. Because chance is the only input, the list of rolls is the game: tests, replay, undo and recovery are the same thing. Online, each roll has a number, so that a repeated request finds its answer.