Design a Snake-Ladder Game
Requirements
- Players shall be able to play the game with snakes and ladder on a board having 100 cells.
- Game ends when 1 player is left
- Dice gives the number uniformly in any range.
-
Future Scope to add fishes in board
- We may add fishes on board in future
Translation into Objects
- GAme has a Board,multiple Players and Dice.
- Game has rules.
- Game knows the turn of a player
- Game has a winner
- Board has cells.
- cells may or may not have objects like snake/ladder/fishes.
- Player has a symbl.
- we can have an AiPlayer
- We can have Human Players
- Dice behavior has to be uniform for all the numbers being generated.
Expected Queries
Class Diagram Walk Through
- Board and cells need to be built.
- Since cells are of different type we are using factory pattern to generate different cells.
- Players are of different type we are using factory pattern to generate different players.
- Building a player is done using builder pattern.
ClassDiagram
Link

Code
Link