0% found this document useful (0 votes)
444 views

Micro - PWP Final

The document describes a project report on developing a Ludo game. It includes an introduction to the classic board game, along with chapters covering the hardware and software requirements, proposed methodology, advantages and disadvantages of the project. The goal is to design the Ludo game using Python scripts to simulate the gameplay, rules, and interface within a console or command line environment.

Uploaded by

Prasad Bhumkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
444 views

Micro - PWP Final

The document describes a project report on developing a Ludo game. It includes an introduction to the classic board game, along with chapters covering the hardware and software requirements, proposed methodology, advantages and disadvantages of the project. The goal is to design the Ludo game using Python scripts to simulate the gameplay, rules, and interface within a console or command line environment.

Uploaded by

Prasad Bhumkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

The Ludo Game

A
PROJECT REPORT
ON

“THE LUDO GAME”

SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE AWARD

OF

DIPLOMA IN

COMPUTER ENGG

SUBMITTED TO
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,
MUMBAI
SUBMITTED BY
Name of Student Enrollment No.
1. Bhumkar Prasad Santosh 1909920093
GUIDED BY
(Prof. Kurhade N. P.)

SAMARTH POLYTECHNIC, BELHE


The Ludo Game

SAMARTH POLYTECHNIC, BELHE

CERTIFICATE
This is to certify that the project report entitled “THE LUDO GAME”
Was successfully completed by Student of sixth semester Diploma in
computer engineering.

1. Bhumkar Prasad Santosh.

in partial fulfillment of the requirements for the award of the Diploma in


Computer engineering and submitted to the Department of Computer of Samarth
Polytechnic, Belhe work carried out during a period for the academic year 2019-
20 as per curriculum .

Prof. Kurhade N. P. Prof. Pokharkar M.S. Prof. Kapile A.S

(Subject Teacher) (H.O.D) (Principle)


The Ludo Game

ACKNOWLEDGMENT

This project is done as a semester project, as a part course titled “THE LUDO GAME”

We are really thankful to our course the Principal Prof. Kapile A. S. and the HOD
Mr. Pokharkar M.S. Samarth Polytechnic, Belhe for his invaluable guidance and assistance,
without which the accomplishment of the task would have never been possible.

We also thank Prof. Kurhade N. P. for giving this opportunity to explore into the real
world and realize the interrelation without which a Project can never progress. In our present
project we have chosen the topic titled “THE LUDO GAME”.
We are also thankful to parents, friend and all staff of Computer engineering department, for
providing us relevant information and necessary clarifications, and great support.

1. Bhumkar Prasad Santosh.


The Ludo Game

INDEX

Sr. No. Chapter Name Page no.

1. Synopsis 01

2. Abstract 02

3. Introduction 03

4. Hardware and Software 04


Requirement
5. Narrative 05

6. Advantages and 07
Disadvantages
7. Features 08

8. Program 10

9. Outputs 32

10. Conclusion 37

11. References 38

CHAPTER 1
SYNOPSIS
The Ludo Game

Project Title
The Ludo Game

Project Option
None

Internal Guide
Prof. Kurhade N. P.

Problem Statement
To design the the Ludo Game using Android Studio
CHAPTER 2
ABSTRACT

Ludo Game project is written in Python. The project file contains python scripts (game.py,
run.py, painter.py, recorder.py). This is a simple console based strategy board game which is very
easy to understand and use. Talking about the gameplay, all the playing rules are the same just like
we play in real time Ludo. Here at first, the user has to select players i.e. either human or computer.
After selecting human, the player has to enter details such as name and select color (red, green,
yellow and blue). The player can also start the game within two players if he/she wants.

After starting the game, a console based Ludo board appears, other rules are the same. First,
the computer or the player has to roll the dice. The main thing in this console based game is that the
player just has to press “Enter Key” to roll the dice. At the top of the board, it displays a dice with
the number. The system keeps on rolling until there’s a possible pawn to move.

All the game movements are performed automatically. Whenever the player tries to end the
game, there’s an option available to save the unfinished game so that he/she can continue it later. A
simple console GUI is provided for the easy gameplay. The gameplay design is so simple that user
won’t find it difficult to use and understand.
CHAPTER 3
INTRODUCTION

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 die. Like other cross and circle games,
Ludo is derived from the Indian game Pachisi, but simpler. The game and its variations are popular
in many countries and under various names. Pachisi was created in India in the 6th century.

The earliest evidence of this game's evolution in India is the depiction of boards on the caves
of Ellora. The original version is also described in Indian epic Mahabharata in which Shakuni uses
the cursed dice to beat the Pandavas and at last after losing everything, Yudhisthira puts his
wife Draupadi on stake and loses her too.

However, Pandavas get all their belongings back after Draupadi vows to curse the
whole Kuru lineage but stops at the intervention of Gandhari and seeing an opportunity to vent
Draupadi's anger, Kuru king Dhritarashtra promises to give back the Pandavas, all that they had lost
in the game.

It was also known as Chaupar in ancient times. The contemporary version was played by
the Mughal emperors of India; a notable example is Akbar. Pachisi was modified to use a cubic die
with dice cup and patented as "Ludo" in England in 1896. The Royal Navy took Ludo and converted
it into the board game Uckers.
CHAPTER 4

HARDWARE & SOFTWARE REQUIREMENT

 Hardware Requirement:

I. i3 Processor Based Computer or higher

II. Memory: 1 GB RAM III. Hard Drive: 50 GB

III. Internet Connection

 Software Requirement:
I. Windows 7

II. python-395

III. Command prompt

IV.  Pycharm edu 

V. Microsoft Word
The Ludo Game

CHAPTER 5
Proposed Methodology

A Use case is a description of set of sequence of actions graphically it is


rendered as an ellipse with solid line including only its name. Use case diagram is a
behavioral diagram that shows a set of use cases and actors and their relationship. It is
an association between the use cases and actors. An actor represents a real-world
object.

9|Page
Elements of the model

Player:

This is modelled by a node type. Players can have an identifier or color to


distinguish them. The cyclic order of players is typically modelled explicitly
(through edges).

Pawn:

This is modelled by a node type. Each pawn belongs to a certain player; this
is typically modelled by an edge, or in some cases by an attribute.

Field:

This is modelled by a node type. Entry and goal fields are special kinds of
fields, typically modelled by subtypes, or in some cases marked by special
10 | P a g e
self-loops. The same may be done for home fields, although these are not
essential for the game (we left them out of Fig. 2). Entry and goal (and
home) fields belong to a player; this is typically modelled by an edge. The
position of a pawn (on a field) is likewise modelled by an edge.

Board:

This consists of all the fields and their interconnections, i.e., the next fields
and the junctions to the goal fields. The interconnections may be turned into
nodes, but typically will be modelled by edges. The board itself does not
necessarily need a special node, since all fields already implicitly belong to
it.

Die:

This is modelled by a (singleton) node, possibly of a special type but


optionally integrated with some existing node. The outcome of a die roll is
then typically an attribute of the die node.

Strategy:

This is modeled by a node or an attribute value; a player can then be


assigned a strategy by adding an edge or attribute.
CHAPTER 6
ADVANTAGES & DISADVANTAGES

ADVANTAGES

i. Display message on screen using Python script on IDE.


ii. Develop python program to demonstrate use of Operators
iii. Perform operations on data structures in Python.
iv. Develop functions for given problem.
v. Design classes for given problem.
vi. Handle exceptions.

11 | P a g e
DISADVANTAGES

i. Turn shortage.
ii. . Limited player to play this game.
iii. Limited opportunity to complete the game

12 | P a g e
CHAPTER 7
Actual Methodology Followed

Figure shows the spiral model of software development. This model is combination of well-
known waterfall model and iterative prototyping. It yields rapid development of more complete
version of software. Using spiral model software is developed as series of Evolutionary releases.
During the initial releases, it may just paperwork or prototype. But during later releases the version
goes towards more completed stage.

The spiral model can be adopted to apply throughout entire lifecycle of the application from
concept development to maintenance. The spiral model is divided into set of framework activities
defined by software engineer team. The initial activity is shown from center of circle and
developed in clockwise direction.

Each spiral of the model includes following four stages:

13 | P a g e
Planning Phase:

This stage includes requirement gathering, cost estimation, resource allocation. Risk
Analysis Phase: This stage involves strengths and weaknesses of the project. Design Phase: This
stage includes coding, internal testing and deployment.
Evaluation Phase: Last stage involves client evaluation (client side testing) to get the feedback.
Various activities which are performed according to the spiral model phases are shown Tab.

14 | P a g e
CHAPTER 8
Program

from .game import Player, Game


from .painter import present_6_die_name
from .recorder import RunRecord, MakeRecord
from os import linesep

class CLIGame(): def

it (self):
self.prompt_end = "> "
self.game = Game() #
used for nicer print
self.prompted_for_pawn = False #
saving game data
self.record_maker = MakeRecord() #
getting game data self.record_runner =
None

def validate_input(self, prompt, desire_type, allawed_input=None,


error_mess="Invalid Option!", str_len=None):
'''
loop while receive correct value
param allowed_input can be list of allowed values
param str_len is two sized tuple if min and max
'''
prompt += linesep + self.prompt_end
while True:
choice = input(prompt) if
not choice:
print(linesep + error_mess)
continue
try:
choice = desire_type(choice)
except ValueError:
print(linesep + error_mess)
continue
if allawed_input:
if choice in allawed_input:
15 | P a g e
break
else:
print("Invalid Option!")
continue
elif str_len:
min_len, max_len = str_len
if min_len < len(choice) < max_len:
break

else:
print(linesep + error_mess)
else:
break
print()
return choice

def get_user_initial_choice(self):
text = linesep.join(["choose option",
"0 - start new game", "1
- continue game",
"2 - run (review) recorded game"])
choice = self.validate_input(text, int, (0, 1, 2)) return
choice

def prompt_for_file(self, mode="rb"):


'''return file descriptor'''
text = "Enter filename (name of the record)"
while True:
filename = self.validate_input(text, str)
try:
file_descr = open(filename, mode=mode)
return file_descr
except IOError as e:
print(e) print("Try
again")

def does_user_want_save_game(self):
'''return True if user want to save game
or False
'''
text = linesep.join(["Save game?", "0
- No",
"1 - Yes"])
choice = self.validate_input(text, int, (0, 1))
return choice == 1
16 | P a g e
def prompt_for_player(self):
''' get player attributes from input,

initial player instance and


add player to the game
'''
available_colours = self.game.get_available_colours()
text = linesep.join(["choose type of player",
"0 - computer",
"1 - human"])
choice = self.validate_input(text, int, (0, 1))

if choice == 1:
name = self.validate_input("Enter name for player",
str, str_len=(1, 30))
available_options = range(len(available_colours)) if
len(available_options) > 1:
# show available colours
options = ["{} - {}".format(index, colour) for
index, colour in zip(available_options,
available_colours)]
text = "choose colour" + linesep
text += linesep.join(options)
choice = self.validate_input(text, int, available_options)
colour = available_colours.pop(choice)
else:
# only one colour left
colour = available_colours.pop()
player = Player(colour, name, self.prompt_choose_pawn)
elif choice == 0:
# automatically assign colours
colour = available_colours.pop()
player = Player(colour)
self.game.add_palyer(player)

def prompt_for_players(self): '''put


all players in the game'''
counts = ("first", "second", "third", "fourth last")
text_add = "Add {} player"
for i in range(2):
print(text_add.format(counts[i]))
self.prompt_for_player()
print("Player added")

text = linesep.join(["Choose option:",

"0 - add player",


17 | P a g e
"1 - start game with {} players"]) for
i in range(2, 4):
choice = self.validate_input(text.format(str(i)), int, (0, 1)) if
choice == 1:
break
elif choice == 0:
print(text_add.format(counts[i]))
self.prompt_for_player()
print("Player added")

def print_info_after_turn(self):
'''it used game attributes to print info'''
pawns_id = [pawn.id for pawn in self.game.allowed_pawns] #
nicer print of dice
message = present_6_die_name(self.game.rolled_value,
str(self.game.curr_player)) message
+= linesep
if self.game.allowed_pawns: message_moved =
"{} is moved. ".format(
self.game.picked_pawn.id) if
self.prompted_for_pawn:
self.prompted_for_pawn = False
print(message_moved)
return
message += "{} possible pawns to move.".format( "
".join(pawns_id))
message += " " + message_moved if
self.game.jog_pawns:
message += "Jog pawn "
message += " ".join([pawn.id for pawn in self.game.jog_pawns])
else:
message += "No possible pawns to move."
print(message)

def print_standing(self):
standing_list = ["{} - {}".format(index + 1, player)
for index, player in enumerate(self.game.standing)]
message = "Standing:" + linesep + linesep.join(standing_list)
print(message)

def print_board(self):

print(self.game.get_board_pic())

def run_recorded_game(self):
'''get history of game (rolled_value
and index's allowed pawn) from
18 | P a g e
record_runner in order to replay game'''
self.load_recorded_players()
self.print_players_info()
self.prompt_to_continue()
for rolled_value, index in self.record_runner:
self.game.play_turn(index, rolled_value)
self.print_info_after_turn() self.print_board()
self.prompt_to_continue() self.print_board()

def continue_recorded_game(self):
'''move forward the game by calling
play_turn method to the moment where
game was interrupted.
'''
self.load_recorded_players()
self.record_players()
for rolled_value, index in self.record_runner:
self.game.play_turn(index, rolled_value)
self.record_maker.add_game_turn(
self.game.rolled_value, self.game.index)
self.print_players_info()
self.print_info_after_turn()
self.print_board()

def record_players(self): '''save


players on recorder'''
for player in self.game.players:
self.record_maker.add_player(player)

def load_recorded_players(self): '''get


recorded (save) players from
recorder and put them in game
'''
if self.record_runner is None: file_descr
= self.prompt_for_file()
self.record_runner = RunRecord(file_descr)

file_descr.close()
for player in self.record_runner.get_players(
self.prompt_choose_pawn):
self.game.add_palyer(player)

def load_players_for_new_game(self):
self.prompt_for_players()
self.print_players_info()
self.record_players()

def play_game(self): '''mainly


19 | P a g e
calling play_turn
Game's method while game finished '''
try:
while not self.game.finished:
self.game.play_turn()
self.print_info_after_turn()
self.print_board()
self.record_maker.add_game_turn(
self.game.rolled_value, self.game.index)
self.prompt_to_continue()
print("Game finished")
self.print_standing()
self.offer_save_game()
except (KeyboardInterrupt, EOFError):
print(linesep +
"Exiting game. " +
"Save game and continue same game later?")
self.offer_save_game()
raise

def offer_save_game(self):
'''offer user save game'''
if self.does_user_want_save_game():
file_descr = self.prompt_for_file(mode="wb")
self.record_maker.save(file_descr)
file_descr.close()
print("Game is saved")

def start(self):
'''main method, starting cli'''
print()

try:
choice = self.get_user_initial_choice() if
choice == 0: # start new game
self.load_players_for_new_game()
self.play_game()
elif choice == 1: # continue game
self.continue_recorded_game() if
self.game.finished:
print("Could not continue.",
"Game is already finished",
linesep + "Exit")
else:
self.prompt_to_continue()
self.play_game()
elif choice == 2: # review played game
self.run_recorded_game()
20 | P a g e
except (KeyboardInterrupt, EOFError):
print(linesep + "Exit Game")
if name == ' main ':
CLIGame().start()
def offer_save_game(self):
'''offer user save game'''
if self.does_user_want_save_game():
file_descr = self.prompt_for_file(mode="wb")
self.record_maker.save(file_descr)
file_descr.close()
print("Game is saved") def

start(self):

CHAPTER 9
Outputs
1.

21 | P a g e
2.

22 | P a g e
3.

23 | P a g e
4.

24 | P a g e
CHAPTER 10

CONCLUSION

Ludo is a simple board game, for two to four players, in which the players race their four
coins from start to finish according to dice rolls, and enjoy game, all the playing regulations
coincide similar to we play in real time Ludo. Below initially, the individual needs to select players.

25 | P a g e
CHAPTER 11

REFERENCE

 https://www.python.com/intl/en_in/

 https://en.wikipedia.org/wiki/python

 https://developer.python.com/studio/index.html

 https://www.tutorialspoint.com/python/

 https://python-developers.blogspot.com/2016/09/

 https://www.parallelcodes.com/python-ludo-game-tutorial/

 https://www.developerfeed.com/python/

26 | P a g e

You might also like