Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DICE GAME PYTHON PROGRAMMING I want to make a dice game like this in python: Twenty-one dice can be played with any number of players

DICE GAME PYTHON PROGRAMMING

I want to make a dice game like this in python: Twenty-one dice can be played with any number of players and one dice. The goal for each player is to get 21 points, or as close to 21 as possible. If you get more than 21 points you have lost. At the start of the player, each player throws the dice three times and summarizes the values. This is the score the player starts with. For each round, the player gets to know his score and can choose to end or throw the dice. If the player throws the dice, the player's score is increased by the number of the dice. If the player gets more than 21 points, the player has lost and is out of the game. The player who has received the most points but no more than 21 has won.

can anyone help to make this this way: Create a class that represents the game itself. The game must have at least one dice and a list of players. Create a function that creates a player based on user input. The function should read the name from the user, throws the dice three times and sets the score equal to the sum of those three dice. The function should return a reference to the player object that was created. Create a method in the class for the game that plays a lap for one player. The method should take the player object to the player as a parameter. The method should: Show who their turn is by printing a message that includes the name of the player Print the score of the player Ask if the player will throw the dice again If the player wants it: roll the dice and add the value to the score Declare if the player has received more than 21 points and thus lost the game Create a script that tests that classes and methods work as far as they should Create a function that requests the number of players and reads it from the user. Then, should The feature creates the specified number of players and puts them in a list of players. The designer of the class of the game itself must take this list of players as a parameter. Create a method in the class for the game that plays a game for all players. That is, every player who has not lost or chosen to finish will still play a new game. You have to find out how the method should distinguish between players who are still involved and non-participating players. Create a method in the class for the game that checks who, if any, has won. For that mandatory part you just need to return one player, you do not have to handle the draw. Create a script that runs the game and plays rounds until someone wins

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

Are psychopaths treatable?

Answered: 1 week ago

Question

Explain basic guidelines for effective multicultural communication.

Answered: 1 week ago

Question

Identify communication barriers and describe ways to remove them.

Answered: 1 week ago

Question

Explain the communication process.

Answered: 1 week ago