Part 2 of 6 · 2 min read
Requirements
The rules people argue about.
Think of a family game night. The first five minutes go on settling the house rules: does a six give another turn, and must the last roll be exact? A design round asks the same questions out loud, since each answer changes the code.
Questions and the answers assumed here:
- How big is the board? 100 squares, but size is a setting.
- How many players? Two or more, taking turns in a fixed order.
- What is a snake and what is a ladder? A snake moves a player down, a ladder moves a player up. Both start on one square and end on another.
- How is the game won? The first player to land exactly on the last square.
- What if a roll goes past the end? The player stays where they are.
- Dice? One die with six faces. Extra turns for a six are out of scope for now.
The numbered requirements:
- R1. Players take turns in a fixed order, and each turn is one roll.
- R2. A roll moves the player forward by its value.
- R3. If the new square holds the start of a snake or ladder, the player moves to its end.
- R4. A roll that would pass the last square leaves the player where they are.
- R5. The first player to reach the last square wins, and play stops.
- R6. A board with impossible jumps is refused when it is built.
The nouns are board, square, snake, ladder, dice, player and game. Notice the key observation: a snake and a ladder are both a jump from one square to another. They differ only in direction. One concept, jump, covers both, and the direction is simply whether the end is higher or lower than the start.
Jump
A jump is a pair of squares: landing on the first moves the player to the second.
Example: the pair 4 to 25 is a ladder, and 27 to 5 is a snake.
Check yourself: 1. What do a snake and a ladder have in common? 2. What happens on a roll that goes past the last square? 3. Why is the board checked when it is built?