Snake and Ladder
A multiplayer board game with configurable board, dice, and jump rules.
Easy30 minGame modellingDice abstractionTurn order
Design a Snake and Ladder game for multiple players on a configurable board. The problem checks clean modelling of a board with jumps, a turn loop, and how you make randomness (dice) swappable and testable.
Requirements
Functional
- Board of N cells (default 100); configurable snakes (head to tail, going down) and ladders (bottom to top, going up).
- 2+ players start at position 0 and take turns rolling a die.
- Move forward by the roll; if you land on a snake head or ladder bottom, jump to its end.
- A player wins on reaching exactly N; overshooting means no move (configurable rule).
- Optional rules: rolling a 6 gives another turn, three 6s in a row forfeits the turn, multiple dice.
- Game ends when one player wins (or continues until ranking is decided, configurable).
Non-functional
- Dice must be injectable for deterministic tests.
- Rules should be extendable without rewriting the game loop.
- Board configuration validated at startup: no cycles, no jump starting at N, no two jumps on the same cell.
Try it first
Set a timer, sketch your own design on paper, then compare it with the reference walkthrough.
30:00
Defend it out loud
The AI interviewer will probe your design for Snake and Ladder and score it.