subject

What you need to know In this program, a roll string is a number, followed by a lowercase "d", followed by another number. The first number is the number of dice to roll. The second number is the number of sides on each die. For example, 1d6 means there is one die with six sides. The total output of the roll is a random whole number between one and six, inclusive. 2d8 means there are two dice, each with eight sides. The total output of the roll is a random whole number between two and 16, inclusive. Since we are using a computer, we can have an input like 500d1000 (meaning a 1000-sided die, rolled 500 times) which would not be possible in real life. Function: get_roll(rollstring)
This function takes an input parameter as a string that looks like "1d3", "3d5", etc. The function should return an integer simulating those dice rolls. In the case of "3d5", for example, the function will generate a random number between one and five, three times, and return the total (sum) as an integer. This function should return the value back to get_damage().
Function: get_damage(attack, defense)
This function gets the value of damage based on roll strings. Player 1 (the first roll) is always on attack; Player 2 (the second roll) is always on defense. If the defense roll is greater than the attack roll, return 0. Otherwise, return attack minus defense, as an integer. This function should call get_roll() twice, once for each Player. This function should return the value back to main_main().
Function: main_menu()
In this function, ask the user how many rounds they want to play. Next, ask the user to input Player 1 and Player 2’s dice for roll one, roll two, etc., up to the number of rolls they entered. The rolls for each round must be entered on one line with no spaces. This function should call get_damage() for each round.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Alcohol’s affects on the cornea and lens of the eye make it more difficult
Answers: 1
You know the right answer?
What you need to know In this program, a roll string is a number, followed by a lowercase "d", follo...
Questions
question
Mathematics, 16.02.2021 22:10
question
Mathematics, 16.02.2021 22:10
question
Mathematics, 16.02.2021 22:10
question
Biology, 16.02.2021 22:20
question
Social Studies, 16.02.2021 22:20
question
Mathematics, 16.02.2021 22:20
question
English, 16.02.2021 22:20
question
Social Studies, 16.02.2021 22:20
Questions on the website: 13722367