Skip to the guide

Design snake and ladder

BeginnerCase study11 pages

The interviewer asks you to design the software for snake and ladder, the board game. Picture a plain grid of 100 squares drawn on a big sheet of paper. Before the children sit down, a parent writes "go to 34" on a few squares. Once play starts nobody chooses anything: the die says how far you go, and a note on the square says whether you go again.

It is also asked as "snakes and ladders", and the closest other case study is 2048, another game whose randomness is passed in. The rules take a minute to explain, so you are scored on what you leave out.

Below is a full 45-minute round on the LLD framework. You are the candidate. At each Guess before you read on, stop and answer first. The full runnable project, with its tests, is a download in Java, JavaScript and Python.

Run the full project

This design as a project you can run, with its tests and a demo. You only need Java 21, Node 24 or Python 3.13. The README says how to run it.

Step 1 · Clarify the requirements and cut the scope

Minutes 0–5 · How this step works

Interviewer: Design snake and ladder.

You: How big is the board, and how many people play?

Interviewer: 100 cells, though the size should be a setting. 2 to 4 players and one six-sided die.

You: Does anyone choose anything, or does the roll decide every move?

Interviewer: The roll decides.

You: What happens on a roll past the last cell?

Interviewer: Today you stay where you are. Families argue about this, so each game will offer a setting: stay, bounce back, or any roll past the end wins.

You: Where does the layout come from? Can a ladder's top be a snake's head?

Interviewer: It comes from set-up input, which can be wrong. And no, one jump per landing.

You: Then I'll build a board from that input and a playTurn that ends with a winner. A bad board is refused before anyone plays, and a turn after the win is refused. Extra rolls on a 6, screens and saved games are out. OK?

Interviewer: Good.