Giter Site home page Giter Site logo

snakes-and-ladders's Introduction

Snake and Ladders Game

Welcome to the Snake and Ladders game! This project is implemented in Python using the Pygame library. It simulates the classic board game of Snake and Ladders, where players roll a dice and move their tokens according to the number they get on the dice.

The game utilizes a double linked list data structure to represent the game board. Each node in the list corresponds to a tile on the game board. These tiles store various attributes:

  1. Position: An integer value indicating the position of the tile on the game board.

  2. Players_on_tile: A list that stores references to the players currently occupying the tile. This allows for tracking which players are present on each tile.

  3. On_step_move_to: An integer value indicating if the tile has a special feature like a snake or a ladder. If a player lands on a tile with a snake or a ladder, they are moved to the position specified by this value.

  4. Coordinates: A list containing coordinates or other data necessary for displaying the tile on the game board UI.

By using a double linked list, the game can efficiently navigate between tiles in both forward and backward directions. This data structure allows for easy traversal of the game board and facilitates the implementation of game logic such as player movement, checking for special tile features like snakes and ladders, and updating the positions of players accordingly. Additionally, the inclusion of player lists on each tile enables the game to manage player positioning and interactions effectively.

Screenshot

Installation

pip install pygame

Run the game:

python main.py

How to Play

Upon running the game, you will be presented with a menu where you can customize the game settings and board layout. Use the menu options to add or remove tiles, add snakes and ladders, and order positions according to your preference.

Screenshot

Once you're satisfied with the settings, start the game from the menu. Roll the dice by clicking the "Roll the Dice" button. Your color token automatically moves according to the number rolled on the dice. The game will switch turns between players, whose turn colored circle will show under the dice. Continue rolling the dice and moving your colored token until one player reaches the end of the board and wins the game.

Customization

You can customize various aspects of the game, including the board layout and the number of players. Here are some customization options available:

Add or remove tiles at specific positions on the board. Add snakes and ladders to create shortcuts or obstacles for the players. Order positions to arrange the tiles in a specific sequence. Adjust the number of players participating in the game.

Credits

This Snake and Ladders game project was created as my Algorithms and Data Structures university module assigment. It utilizes the Pygame library for graphics and user interface.

Feel free to contribute to this project by submitting bug fixes, feature enhancements, or feedback through issues and pull requests.

Enjoy playing Snake and Ladders! ๐ŸŽฒ๐Ÿ๐Ÿชœ

snakes-and-ladders's People

Contributors

fokus445 avatar

Watchers

 avatar

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.