snake and Ladder (1).pdf made by sumit nagnath gunge
SumitGunge
7 views
7 slides
Oct 30, 2025
Slide 1 of 7
1
2
3
4
5
6
7
About This Presentation
Snake and ladder gme
Size: 2.33 MB
Language: en
Added: Oct 30, 2025
Slides: 7 pages
Slide Content
Implementation of Snakes
and Ladders Game Course : Data Structures and Algorithms (DSA)
Year : Se cond Year Engineering
Language Used : Python
Concept Used : Breadth First Search (BFS) Presented by - Mitali Pawar
Sanika Phadtare
Problem StatementTo design and implement a Snakes and Ladders
game in Python that allows : 1.Interactive gameplay between the user and the computer.
2. Automatic computation of minimum dice throws required to win using Breadth
First Search (BFS).
3.Visualization of how snakes and ladders affect the player’s path.
Concept Used
Breadth First Search (BFS):BFS is used to find the minimum number of dice throws to
reach square 100.
Each cell is treated as a node in a graph.
Edges exist between a node and all nodes reachable within
one dice roll (1–6).
BFS ensures the shortest path (fewest throws) is found
efficiently.
Sample Use Case Walkthrough
Player starts at
position 1.
Rolls the dice →
moves ahead by
dice number.
If on a snake,
slide down.
If on a ladder,
climb up.
Repeat until
reaching 100.
Finally, BFS
shows:
Minimum dice throws
needed.
Optimal path (sequence
of squares).
Key Features Interactive gameplay (user-
controlleddice rolls).
Automatic BFS analysis for optimal path
finding.
Snakes and Ladders logic applied
dynamically.
Step-by-step progress displayed in
console.
Shows comparison between player result
and BFS shortest path. Key Methods Queue (from collections.deque):
Used in BFS for level-order
traversal.
Random module: Generates dice rolls
(1–6).
Parent array: Stores previous position for
reconstructing the BFS path.
Visited array: Ensures no position is
processed twice.
Time.sleep(): Adds delay for smoother
step-by-step animation. Output &
Results Displays real-time game moves
in the console.
Shows snake/ladder encounters.
At the end:
Congratulations! You
reached 100!”
BFS result with minimum
dice throws and path.
ConclusionSuccessfully implemented Snakes & Ladders game using
Python and BFS.
Demonstrated real-world use of graph traversal in a
simple game.
Enhanced understanding of queues, BFS, and shortest
path logic in DSA.
Thank
you very
much!Presented by - 1. Mitali Pawar
2 . Sanika Phadtare