Code Monkey home page Code Monkey logo

snake-and-ladder-game's Introduction

Snake and Ladder Game

Snake and ladder is a simple game consists of snakes and ladders. The object of the game is to navigate one's game piece, according to die rolls, from the start (bottom square) to the finish (top square), helped or hindered by ladders and snakes respectively.

This is a python based version of this game which consist of GUI which is designed using Python's Image library

Libraries Used:-

  1. PIL also known as Python Imaging Library is a free and open-source additional library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats.From where we can import lot of image libraries

  2. Random Module is a built-in module to generate the pseudo-random variables. It can be used perform some action randomly such as to get a random number, selecting a random elements from a list, shuffle elements randomly, etc.

Let's start :


With the help of board image we have to form dictionary of ladder and snake such that ladder={start_point:ending_point},snake={ending_point,starting_point} ladder = {1: 38, 4: 14, 8: 30, 21: 42, 28: 74, 50: 67, 71: 92, 88: 99} snake = {32: 10, 34: 6, 48: 26, 62: 18, 88: 89, 95: 56, 97: 78}

Functions:

def show_board():This Function is needed to show the image of board

def check_ladder(points): It checks the point in Ladder dictionary .If matches Climb up (increment to ending_point).

def check_snake(points): It checks the points in Snake dictoionary .If matches snake bite!(decrement to starting_point).

def reached_end(points): checks weather a points has reached end point that is 100

def play(): It asked for player name and then dice is roll randomly between (1,6)

How to install this

git clone https://github.com/shreya9347/Snake-and-Ladder-game

snake-and-ladder-game's People

Contributors

shreya9347 avatar

Stargazers

 avatar  avatar

Forkers

nidhish99444

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.