Weekly letter pythonprogramming.email
To get the curated list of awesome python articles from all over the Internet, please subscribe with pythonprogramming.email. This is specifically suitable for beginners.
Advertise with us
game   3   6963
Text based snake and ladder game in python

I quickly wrote a python program to play text based snake and ladder game in terminal.

Any advance python concept is not used in this code. However it is a fun thing to do for a beginner in order to learn how to use multiple concepts in your program.

Few basic concepts used in this code are:
    - Dictionary
    - List
    - Generating random number
    - Selecting a Random value from a list
    - Adding wait/sleep in program
    - Conditional Statements i.e. IF and ELSE
    - Getting input from user

You can download the code from Github.

What is happening in Game:
    - Display the welcome message
    - Collect the player's names
    - Until one of the player wins do the following:
        - Roll the dice
        - Move the player forward for the value got on dice roll.
        - If player is on snake's head, move down to its tail
        - If player is on ladder's bottom, take it to its top
        - else remain there and let second player roll the dice

Run the game using command python3 snake_ladder.py.

snake and ladder game in python

You can set the value SLEEP_BETWEEN_ACTIONS to 0 if you do not want any delay while playing game.

game   3   6963

3 thoughts on 'Text Based Snake And Ladder Game In Python'
Siva Kumar :
How to display the movements while playing the game from one to another using image or grid like an app it shows the game?
Admin :
You can implement the same using tkinter or QT

Arya Anil :
how can i draw the dfd of this project
Admin :
Use draw.io site

Niketa Sharma :
Sanke & Ladder game memorises my childhood unforgotten movements. You have shared great information. Thanks for sharing it.
Admin :
Glad you liked it.

Leave a comment:

*All Fields are mandatory. **Email Id will not be published publicly.

Please subscribe to get the latest articles in your mailbox.

© 2017-2020 Python Circle   Contact   Sponsor   Archive   Sitemap