![ryanmorse01](/avatars/41896.jpg)
ryanmorse01
27.11.2019 •
Engineering
Now we want a way to make our monsters fight!
before two monsters can fight, we need to give two new class methods that update their stats.
implement a method for "win_fight" and "lose_fight". win_fight should add 5 to the monster’s self.exp, and reset their current_hp to their max_hp. lose_fight should also reset their hp, but only adds 1 exp to self.exp.
now write a function that takes two instances of the monster class as its input and makes them "fight". a fight goes as follows:
the monster entered as the first function parameter always goes first.
each monster takes a turn using one attack move.
loop over all attacks from most powerful to least powerful attack until there is a winner. if there is a tie in hit points for an attack select using alphabetical order.
an attack is always successful, and decreases the opponent’s current_hp by the given number of points. monsters continue taking turns until one of them reaches current_hp less than or equal to 0, at which point the win_fight and lose_fight methods should be invoked. once the fight is complete, return the round number in which the fight ended, the monster that won and the list of attacks the winning monster used. if both monsters only have "wait" as an attack, return -1, none, non
Solved
Show answers
More tips
- S Sport When will the Biathlon World Championships 2011 take place in Khanty-Mansiysk? Answers to frequently asked questions...
- H Health and Medicine Trading Semen for Money: Where Can You Sell and Why Would You Want to?...
- F Food and Cooking Homemade French Fries: The Ultimate Guide...
- H Health and Medicine How to Increase Blood Pressure without Medication?...
- S Style and Beauty Choosing a Hair Straightener: Specific Criteria to Consider...
- F Food and Cooking How to Make Polendwitsa at Home?...
- S Science and Technology When do we change our clocks?...
- L Leisure and Entertainment What to Give a Girl on March 8?...
- F Family and Home Is it Worth Knowing the Gender of Your Child Before Birth?...
- C Computers and Internet Why is Yandex s robot Bless.yandex.ru Important?...
Answers on questions: Engineering
- H History Clay s plan to encourage an end to sectionalism was called: a. the doctrine of nullification b. the american plan c. secession...
- M Mathematics In the 1992 presidential election Alaska s 40 election districts averaged 1955 votes per district for President Clinton. The standard deviation was 556. (There are only...
- A Advanced Placement (AP) Tik + tok = what? HEL...
- H History Which statement about the role of women in Kush society is accurate? Women could serve as rulers, and they had equal rights. Women were not considered citizens and could...
- M Mathematics The circle graph shows the result of a survey of 1500 middle school students. How many students save their money?...
Ответ:
length of corn field = (40-2x)
Breadth of corn field =(35-2x)
Perimeter of this field = 2(l+b)
P = 2(40-2x+35-2x)P = 150-8x..