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 03:30
Identify at least three types of characteristics that you were asked about as you the computer identify a fruit.
Answers: 3
question
Computers and Technology, 22.06.2019 19:20
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 2
question
Computers and Technology, 22.06.2019 21:50
Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting numbers, and store this value in total. thus your code should put 11 + 22 + 33 + + 4949 + 50*50 into total. use no variables other than k and total.
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
*! 20 points! *jeff wants to create a website with interactive and dynamic content. which programming language will he use? a. dhtml b. html c. css d. javascript
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
Social Studies, 18.05.2021 06:30
question
Mathematics, 18.05.2021 06:30
question
Mathematics, 18.05.2021 06:30
question
Mathematics, 18.05.2021 06:30
Questions on the website: 13722367