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, 21.06.2019 19:30
Why is it a good idea to leave an interview being courteous and polite?
Answers: 1
question
Computers and Technology, 22.06.2019 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e.g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
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, 08.07.2019 11:30
Questions on the website: 13722360