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, 23.06.2019 22:30
The output voltage of a power supply is assumed to be normally distributed. sixteen observations are taken at random on voltage are as follows: 10.35, 9.30, 10.00, 9.96, 11.65, 12.00, 11.25, 9.58, 11.54, 9.95, 10.28, 8.37, 10.44, 9.25, 9.38, and 10.85
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
The gene form of a trait is called a(n) 
Answers: 2
question
Computers and Technology, 24.06.2019 00:30
The best definition of an idiom is a. a word or phrase that describes a noun b. a word or phrase describing a verb c. a phrase containing figurative language in which the word expresses a different idea from its exact meaning d. a phrase that compares two unlike objects or ideas
Answers: 2
question
Computers and Technology, 24.06.2019 03:00
Using a conditional expression, write a statement that increments numusers if updatedirection is 1, otherwise decrements numusers. ex: if numusers is 8 and updatedirection is 1, numusers becomes 9; if updatedirection is 0, numusers becomes 7.
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, 09.09.2020 23:01
question
Social Studies, 09.09.2020 23:01
question
Mathematics, 09.09.2020 23:01
question
Mathematics, 09.09.2020 23:01
question
Mathematics, 09.09.2020 23:01