In this assignment. you are going to design and develop a python
game. Ine game is composed or an even numper or balls and a single scaling device. All balls 100k
identical in size and appearance, and all balls weigh exactly the same except one ball, which is heavier,
called the odd ball. Balls are identified by their number labels in consecutive numerical sequence
Copyright By Assignmentchef assignmentchef
starting with 1. The scale is a balance instrument with a left pan and a right pan used for weighing. the
interact with a player and the player will try to guess the odd ball by repeatedly weighing ditterent ball:
on the scale. During the game the propram and the plaver will take turns in an alternative manner: the
laver chooses some balls to weigh, the propram outouts the result and then promots the user to makt
a guess for the odd ball
At the start of the program, it first prompts the player to enter the number of balls for the game. The
number of balls must be even, minimum 2. After the promot. the game randomly chooses one ball as
balls to be placed on the left pan of the scale, and for the balls on the right. In return the game outputs
the result of the weighine as whether the mass on both pans are balanced, left pan is heavier or right
Dan heavier. finally, the player makes a guess for the odd ball. If the guess is not correct. the game will
a correct guess is received, the game will output the total number of guesses made and total number o
times the scale was useo
At the start of the program. disolav a brief introduction about the
for each game
prompt player for the number of halls the number must be even. minimum 2
Implement the Game Cvcle:
Prompt user for ball weighing
Promot user to make a guess for the odd numbe
Track total number of times the scale used for each game.
Display the scale usage count after the correct guess is entered
At the end of the pame, oromot olaver to quit or start a new game
Inout Validation (User Interface)
Ensure correct input is entered, if not, display prompt again after showing the warning
Ensure that our propram follows the proper lavout structure as discussed in class
used for this
namine convention is in lace to differentiate various variable scope.
Keep our entire source code in ONE SINGLE file
Use only standard python modules
In your design stick ONLY to functions, in other words, no class objects of your owr
STARTUP OPTIONS
Not apolicable
In this assignment. vou willbe trained on the use of the tollowings
Understand requirements as per scope
Use standard python module to design the game program as per scope
Use standard obiects (strings. numbers & lists)
Varianlo Crfor program structure and decompositio
Icorintorarointorartioni
Inout Validation
DELIVERABLES
1. Program source code (Al School StudentiD.py
where School is SSE. SME. HSS. SE or LHS and StudentID is vour 9-dieit student IC
Submit the python file by due date to the corresponding assignment folder unde
(suomission)
A. CME 110010001 0V
ill be deducted if file is incorrectlv named!
CS: assignmentchef QQ: 1823890830 Email: [email protected]
Reviews
There are no reviews yet.