Skip to content

Implemented lodu Game using multi-threading concepts.

Notifications You must be signed in to change notification settings

Anas-hameed/lodu-Game

Repository files navigation

Ludo Game Using Multi-threading in C++

In this i have build a ludo game using mutithreading. Ludo is a strategy board game for two to four players, in which the players race their four tokens from start to finish according to the rolls of a single dies. This project consists of designing a multithreaded application of Ludo for four players each having maximum four tokens. Two, three or four can play, without partnerships. At the beginning of the game, each player’s tokens are out of play and staged in the player's yard (one of the large corner areas of the board in the player's color). When able to, the players will enter their tokens one per time on their respective starting squares, and proceed to race them clockwise around the board along the game track (the path of squares not part of any player's home column). When reaching the square below his home column, a player continues by moving tokens up the column to the finishing square.

Here is the strategy used to implement mutithreading in the Game

  • Four threads are created and will be assigned to each player.
  • A thread to check each row and column of the grid to find out the token and player to be passed for completion. This thread should run randomly to check the hitting token and victim player.
  • One thread known as “Master thread” should track for all four players of hit record asno token can enter into its home column if its hit rate is 0. The property of this thread is it can cancel all the other four threads in certain situations. For example: The stopping criteria or thread cancelation will be as follows:
  • When all tokens of a player reach its home, it will send the signal to this master thread about its completion. The master thread will verify and then kill the respective thread after calculating its position.

Dependencies

  • linux Operating System
  • Pthread library
  • Open Gl Graphics

Requirements to Compiled

  • Operating System:- Any Linux Operating System is required since pthread is not supported in windows OS.
  • Compiler:- G++ compiler is required to compile the code
  • Graphic:-Open Gl graphic is required for game graphics

How to Run

  • Run this command to install necessary graphics of the game " sudo install install-libraries.sh"
  • Run command make to compile the game "make"
  • Run command ./game to play "./game"
  • You are done Have fun playing the game🙂🙂🙂🙂
Contributions are wellcome if you notice any bug and wanted to implement any specific additional functionality.

About

Implemented lodu Game using multi-threading concepts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages