Pythonproject 1
Pythonproject 1
Annexure – I
The main objective for each player is to move all his/her tokens or pieces to the finish before his/her opponents. Of
course, en-route there are some more obstacles that the player has to overcome. Go through these step-by-step
instructions to get a better perspective on how to master this easy game.
P
AP
2.0 Course Outcomes Addressed:
i. Display message on screen using Python script on IDE.
n
ii. Develop python program to demonstrate use of Operators
tio
iii. Perform operations on data structures in Python.
iv. Develop functions for given problem.
v. Design classes for given problem.
lu
P
AP
n
tio
A Use case is a description of set of sequence of actions graphically it is rendered as an
lu
ellipse with solid line including only its name. Use case diagram is a behavioural diagram
So
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.
TE
Player : This is modelled by a node type. Players can have an identifier or colour to
M
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 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.
P
AP
n
tio
lu
So
TE
SB
M
P
o Siddhesh Jagdish
AP
6 Design of System 14/01/2019 19/01/2019 Shelar
7 Coding & Testing of Modules 21/01/2019 25/01/2019 o Jainul Jignesh Dave
o Shreyash Kiran
n
8 Coding & Testing of Modules 28/01/2019 02/02/2019
tio Dahale
o Ojas Yogesh Joshi
9 Coding & Testing of Modules 04/02/2019 09/02/2019
lu
10 Integration of System Modules 11/02/2019 16/02/2019
So
Sr Name of
Specification Qty. Remarks
No Resource/Material
Desktop with Intel Core 2 Duo -
1 Hardware Resource 2.93 GHz, RAM 2GB, HDD 1
160 GB
Software Resource Python IDE -
2 1
3 Any Other Resource Internet - -
P
AP
n
tio
Name & Signature of Course Teacher
(Prof. G.K.GAIKWAD)
lu
So
TE
SB
M
Annexure – I
Micro Project Report
1.0 Rationale:
This is a Ludo 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 colour (red, green, yellow and blue). the player
P
AP
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
n
tio
roll the dice.
lu
So
The main thing in this console based game is that the player just has to press “Enter
TE
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
SB
performed automatically. Whenever the player tries to end the game, there’s an option
M
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
How to Play
1. Ludo player path.
2. Ludo Home.
3. Start area.
5. No resting squares.
P
AP
Game Rules
n
1. Four pieces are placed in the start area of their colour.
tio
2. Throw a single die.
lu
8. No doubling rules.
P
AP
n
tio
lu
So
TE
SB
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:
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 shownTab.
Downloaded From MSBTE Solution App
MSBTE Solution App
Sr
Name of Resource/Material Specification Qty. Remarks
No
Processor i3/HDD-
1 Hardware Resource 1
1TB/RAM-8GB
Python IDE
2 Software Resource 1
P
AP
n
tio
lu
So
TE
SB
M
Code :
from .game import Player, Game
from .painter import present_6_die_name
from .recorder import RunRecord, MakeRecord
from os import linesep
it (self):
self.prompt_end = "> "
self.game = Game() #
used for nicer print
self.prompted_for_pawn = False#
saving game data
P
self.record_maker = MakeRecord()#
AP
getting game data self.record_runner =
None
'''
prompt += linesep + self.prompt_end
while True:
TE
choice = input(prompt)if
not choice:
SB
print(linesep + error_mess)
continue
try:
M
choice = desire_type(choice)
except ValueError:
print(linesep + error_mess)
continue
if allawed_input:
if choice in allawed_input:
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
P
'''return file descriptor'''
AP
text = "Enter filename (name of the record)"
while True:
filename = self.validate_input(text, str)try:
n
file_descr = open(filename, mode=mode)
return file_descr
tio
except IOError as e:
print(e) print("Try
lu
again")
So
def does_user_want_save_game(self):
'''return True if user want to save game
TE
or False
'''
text = linesep.join(["Save game?","0 -
SB
No",
"1 - Yes"])
choice = self.validate_input(text, int, (0, 1))
M
return choice == 1
def prompt_for_player(self):
''' get player attributes from input,
if choice == 1:
name = self.validate_input("Enter name for player",str,
Downloaded From MSBTE Solution App
str_len=(1, 30))
MSBTE Solution App
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" + lineseptext
+= 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
P
colour = available_colours.pop()
AP
player = Player(colour)
self.game.add_palyer(player)
n
def prompt_for_players(self): '''put
all players in the game'''
tio
counts = ("first", "second", "third", "fourth last")
text_add = "Add {} player"
lu
for i in range(2):
So
print(text_add.format(counts[i]))
self.prompt_for_player()
print("Player added")
TE
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
Downloaded From
if self.game.allowed_pawns: message_moved = MSBTE Solution App
MSBTE Solution App
P
def print_standing(self):
AP
standing_list = ["{} - {}".format(index + 1, player)
for index, player in enumerate(self.game.standing)]
message = "Standing:" + linesep + linesep.join(standing_list)
n
print(message) tio
def print_board(self):
lu
print(self.game.get_board_pic())
So
def run_recorded_game(self):
'''get history of game (rolled_valueand
TE
self.print_players_info()
self.prompt_to_continue()
M
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() Downloaded From MSBTE Solution App
MSBTE Solution App
self.print_board()
P
file_descr.close()
for player in self.record_runner.get_players(
AP
self.prompt_choose_pawn):
self.game.add_palyer(player)
n
def load_players_for_new_game(self):
tio
self.prompt_for_players()
self.print_players_info()
lu
self.record_players()
So
try:
while not self.game.finished:
self.game.play_turn()
SB
self.print_info_after_turn()
self.print_board()
M
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")
Downloaded From MSBTE Solution App
self.record_maker.save(file_descr)
MSBTE Solution App
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:
P
print("Could not continue.",
"Game is already finished",
AP
linesep + "Exit")
else:
self.prompt_to_continue()
n
self.play_game()
tio
elif choice == 2: # review played game
self.run_recorded_game()
lu
except (KeyboardInterrupt, EOFError):
print(linesep + "Exit Game")
So
self.record_maker.save(file_descr)
file_descr.close()
M
print("Game is saved")def
start(self):
Outputs
1.
P
AP
n
tio
lu
So
2.
TE
SB
M
3.
P
AP
n
tio
lu
4.
So
TE
SB
M
a) Practical Outcomes:
P
Selection of the most effective solution
AP
c) Outcomes in Affective Domain:
CONCLUSION
Ludo is a simple board game, for two to four players, in which the
TE
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
SB