Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

python problem: For this exercise, you have to write a program that returns the result of a fight between two players. First, player 1 enters

python problem: For this exercise, you have to write a program that returns the result of a fight between two players. First, player 1 enters a number of points, then a list of heroes. The number of points is equal to the sum of the heroes' life points (HP) with the following rule: A = 1 HP, B = 2 HP, C = 3 HP, ..., M = 13 HP, ..., Z = 26 HP . Subsequently, player 2 also enters his list of heroes. Once the data is entered, the fight begins. In the first round, we take the heroes of player 1 and player 2 at index 0. We subtract the VP of hero 2 from hero 1 and we subtract the VP of hero 1 from hero 2. Then we check if one of the heroes is dead (PV <= 0), if this is the case we take the next hero in the hero list of the corresponding player. The fight ends as soon as a player's last hero runs out of VP. If player 1 has heroes left with VPs and player 2's heroes have no VPs left, player 1 wins the game. If it is the other way around, player 2 wins the game. Otherwise, the message "Drawn match" is displayed. There are two end-of-turn dynamics: At the end of the turn, if a hero remains in play (therefore he is not dead) and he has at least 2 VP then he loses 1 VP due to fatigue. When a hero enters play, he gains 2 VP if his opponent has 2 VP or less. It's kind of a confidence boost. Here are the design criteria: - Each hero is represented by a character from the alphabet. - The hero list must not contain duplicates, and must be converted to upper case. - The total number of VP of each player is equal to the number of points entered by player 1. - If one of the two players enters an erroneous data, then the program stops. We do not ask again to enter a data. - The minimum value of a hero's health is 0. You must check after each fight and before the end of turn dynamics.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Finance questions