Design a Snakes and Ladders Game
Model the board, snakes and ladders, players, dice, turns, the exact-landing win rule, board validation, and testable rule variants.
Design a Snakes and Ladders game.
For this exercise, assume one game runs in a single process. The board has numbered cells from 1 to N, where N is chosen when the board is set up (100 in the classic game). The board also gets a list of snakes and ladders at set-up time.
A snake moves a token down from its head to its tail, and a ladder moves a token up from its bottom to its top. Two to four players take turns in a fixed order. Each player has one token, and every token starts off the board, before cell 1.
For this exercise, assume that on each turn the current player rolls one six-sided die and moves their token forward by the number rolled. If the token lands on the start of a snake or a ladder, it moves to that snake's or ladder's end, once.
If the roll would take the token past cell N, the token does not move and the turn passes to the next player. Each turn is requested for a named player; a request for a player whose turn it is not, or any request after the game has ended, is rejected and changes nothing.
Several tokens may share a cell, and tokens never capture each other. The first player whose token ends a turn exactly on cell N wins, and the game then accepts no more turns.
For this exercise, assume a board set-up must be checked before play starts: every snake and ladder stays inside the board, every snake ends below its head and every ladder ends above its bottom, no cell is the start of more than one snake or ladder, nothing starts on cell N, and no snake or ladder ends on a cell where another one starts.
The game should be easy to test, and the dice and turn rules are expected to change later.
Design the requirements, object model, focused contracts, and interactions for this game. Code is not required. A user interface, networking, saving and loading games, computer players, and betting are outside scope.