Home / Expert Answers / Computer Science / in-python-please-you-need-to-write-a-dice-playing-game-the-game-emulates-throwing-a-normal-6-si-pa836

(Solved): In python please. You need to write a dice playing game. The game emulates throwing a normal 6 si ...



In python please.

You need to write a dice playing game. The game emulates throwing a normal 6 sided dice. Only numbers between 1 and 6 inclusiTesting code and creating your answer file.
The code on this page is only provided to help you test your code in the same wayTestExample2.pyInstructions for creating your answer file.
- Copy Testexample3.py to question_3.py and use this as the basis for your answerWrite a program that adheres to the section 2 specification.
Each test below is worth \( 0.5 \) marks.
Hint.
- Not all the teAnswer: (penalty regime: \( 0,10,20, \ldots \% \) )

You need to write a dice playing game. The game emulates throwing a normal 6 sided dice. Only numbers between 1 and 6 inclusively are valid. The winner is the first player who receives a 6. The dice will be rolled (thrown) a maximum of 5 times per game (regardless of the number of players). each player name. 5 th throw of the dice and the players are informed that nobody won. You can assume the following: - Only integers between 1 and 5 inclusively will be entered as the number of players. The number of players does not need to be validated. - Each player will enter a unique name. No validation of the name is needed. Names to be displayed appropriately though. See the test cases for examples. test your code, please test your code with values that are not shown in the test cases. Modify the following to generate the random number for the dice. You must import the module using import game dice Ensure num is not used in your code. import game_dice num = game_dice.roll_dice() Testing code and creating your answer file. The code on this page is only provided to help you test your code in the same way that Moodle does. Make a new directory called PortfolioAssessment on the Desktop. Use Idle or Notepad++ to work with the following code in that directory. Save each file as the filename shown in bold. game_dice.py \# Do \( \star_{\text {not* }} \) check or submit the following to Moodle \# This is game_dice.py \# Modify the next line for each test case seen in Moodle sequence \( =[1,5,4,3,5] \) \# sequence \( =[1,6] \) * Don't modify anything in this file below this line not_random = iter(sequence) def roll_dice(*args): "" Returns the next value from the iterable sequence"" return (next (not_random)) \# Do \( { }^{\star n o t}{ }^{*} \) check or submit the above to Moodle TestExample1.py \# This is Testexample1.py \# Test code for showing dice numbers returned by the roll_dice function import game_dice MAX_GOES \( =5 \) for go in range (0, MAX_GOES): num = game_dice.roll_dice () print (f'Go\#\{go+1 \( \}:\{ \) num \( \} \) ') print('Look at the value of sequence in game_dice.py and notice how the numbers \( 1,5,4,3,5 \) are displayed above.') TestExample2.py Instructions for creating your answer file. - Copy Testexample3.py to question_3.py and use this as the basis for your answer to this question. - question_3.py needs to be in the PortfolioAssessment directory. - game_dice.py needs to be in the PortfolioAssessment directory. - In game_dice.py, the sequence object refers to the test values e.g. sequence \( =[1,6] \) - Modify game_dice.py when you want a different sequence of dice throws to be generated. Ensure you save game_dice.py every time you modify it. When you are running your assessment code, if it generates an error when you call the roll_dice function when the sequence is sequence \( =[1,6] \) then there is something wrong with your code as 6 is the winning number and your code should have stopped asking for a dice number at that point. When you are running your assessment code, if it shows a 6 when you call the roll_dice function when the sequence is sequence \( =[5,4,4,3,1,6] \) then there is something wrong with your code as there are a maximum of 5 throws per game and your code should have stopped asking for a dice number when 1 was returned. Write a program that adheres to the section 2 specification. Each test below is worth \( 0.5 \) marks. Hint. - Not all the tests used are visible. Paste your game code from question_3.py below. Do not include the code for game_dice.py. For examole: Answer: (penalty regime: \( 0,10,20, \ldots \% \) )


We have an Answer from Expert

View Expert Answer

Expert Answer


Python main program Code Snippet: import game_dice MAX_GOES = 5 # Get the number of players count playerCount = input('Please enter the number of play
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe