1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jeka57 [31]
2 years ago
14

Please answer the following in python: Answering the ones that have #TODO

Computers and Technology
1 answer:
zalisa [80]2 years ago
5 0

Answer:

Please answer the following in python: Answering the ones that have #TODO

from DiceQuad import DiceQuadclass PigPlayer:

WINNING_SCORE = 100

AUTO_WIN_RECOGNITION_ON = True

numPlayers = 0

def __init__(self, owner, name = "Player"):

self.owner = owner

self.name = name

self.dice = DiceQuad()

self.score = 0

self.roundScore = 0

self.isPlayerTurn = False

PigPlayer.numPlayers += 1

def reset(self):

''Resets all player values to their default value at the start of a game''

#TODO

pass

def getName(self):

'''Return the name of the player'''

return self.name

def getCurrentScore(self):

'''Return the current score of the player. If it is currently the player's turn,

include the round score'''

#TODO

pass

def hasWon(self):

'''Return boolean if the player has won'''

#TODO

pass

def __str__(self):

'''String representation of this class is the current total score, along with the

current round score (which could still be lost, in the case the turn is still

on), or the last round score, if it's the other player's turn'''

return (self.name + "\'s score: \t" + str(self.getCurrentScore()) + "\t"+

(" (this round so far: " if self.isPlayerTurn else " (last round's score: ")+ "\t" + str(self.roundScore) + ")")

def displayNum1s(self):

'''Prints a message about how many 1s were rolled. Also prints what happens as a consequence.

EX:

Player 1 rolled 3 ones

Player 1 loses all points'''

num1s = self.dice.num1s()

print(self.name + " rolled " + str(num1s) + " ones")

if(num1s == 1):

#TODO

pass

elif(num1s == 2):

#TODO

pass

elif(num1s == 3):

#TODO

pass

elif(num1s == 4):

#TODO

pass

def displayDice(self):

print(self.dice)

def displayDoRoll(self):

self.owner.displayScores()

print(self.name + " rolls... ")

def doRoll(self):

'''Rolls the dice for the player. Based on the number of 1s left, either asks the player if they want to roll again

or ends the turn with the proper consequence. If AUTO_WIN_RECOGNITION_ON is True, ends the turn automatically when

player has won including the most recent roll'''

self.displayDoRoll()

self.dice.roll()

self.displayDice()

num1s = self.dice.num1s()

if(num1s == 0):

#TODO

pass

elif(num1s == 1):

#TODO

pass

elif(num1s == 2):

#TODO

pass

elif(num1s == 3):

#TODO

pass

elif(num1s == 4):

#TODO

pass

def doTurn(self):

'''Performs a full turn for the player'''

self.roundScore = 0

self.isPlayerTurn = True

while (self.isPlayerTurn):

self.doRoll()

if(self.isPlayerTurn):

self.isPlayerTurn = not self.wantsHandOver()

self.score += self.<em><u>roundScorenxnd</u></em><em><u> </u></em><em><u>dd</u></em>

You might be interested in
A picture of kitchen sink draining system​
ale4655 [162]

Answer: So do you need a picture of that or what do you need exactly i would love to help!!

5 0
3 years ago
Read 2 more answers
What is the best programming language
pashok25 [27]

Answer:

Ther are 8 best programming language :

• Javascript

• Swift

• Scala

• Go

• Python

• Elm

• Ruby

• C#

4 0
2 years ago
Atheel tests a program and gets a NameError. How can this be fixed?
Oksana_A [137]

Answer:

You can't call a function unless you've already defined it. Move the def createDirs(): block up to the top of your file, below the imports.

Explanation:

Some languages allow you to use functions before defining them. For example, javascript calls this "hoisting". But Python is not one of those languages.

7 0
3 years ago
Read 2 more answers
How to solve level 53 on rapid router?
alexgriva [62]

&lt;img src=/static/game/image/actions/go.svg alt=' + ugettext(play= button)= += '= style=width: 4%;&gt; ) def noPermissionMessage():

6 0
2 years ago
Which two graphs best represent the motion of an object falling freely?
larisa [96]
The graph would have to be pointing completely down to be falling freely.
4 0
3 years ago
Other questions:
  • 12. Noodle Tools is a website that
    8·1 answer
  • Which best explains what a credit score represents
    10·2 answers
  • FTP requires confirmation that a file was successfully transmitted to a client, but it has no built-in mechanism to track this i
    7·2 answers
  • Who PLAYS Apex Legend?
    10·2 answers
  • In rolling a die four times, what is the odds that at least one 5 would appear?
    6·1 answer
  • What is the hexadecimal equivalent of the decimal number 256?
    11·1 answer
  • Describe markings on a road that indicate that it is safe to pass.
    10·1 answer
  • Which of the following examples can be solved with unsupervised learning?
    8·1 answer
  • Who is big brain me or you
    14·1 answer
  • In the bremmer article, the author states that _________ translates into greater risks.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!