Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to make a turn-based game for my Cs class (in python). The instructions are below: Using a loop, simulate a battle between Krogg

I need to make a turn-based game for my Cs class (in python).

The instructions are below:

Using a loop, simulate a battle between Krogg and the boss where Krogg attacks the boss, then the boss attacks Krogg repeatedly until one of the two characters has died. _**Note:** A character has died if and when their HP reaches zero (more precisely, 0)_ Each time the loop iterates, one round of fighting will occur. Each character will attack exactly once per round. Your loop will also display a summary after the round has finished. The loop will continue as long as both Krogg and the boss are still alive (i.e. Krogg's HP > 0 and the boss' HP > 0). Below is the sample output, using the values given in code listing 1.

Write your code that matches the output below:

### Sample Output 1 ``` Round 1 Krogg does 26.0 points of damage to Boss Boss does 5.0 points of damage to Krogg Boss: 174.0 Krogg: 195.0

Round 2 Krogg does 26.0 points of damage to Boss Boss does 5.0 points of damage to Krogg Boss: 148.0 Krogg: 190.0

Round 3 Krogg does 26.0 points of damage to Boss Boss does 5.0 points of damage to Krogg Boss: 122.0 Krogg: 185.0

Round 4 Krogg does 26.0 points of damage to Boss Boss does 5.0 points of damage to Krogg Boss: 96.0 Krogg: 180.0

Round 5 Krogg does 26.0 points of damage to Boss Boss does 5.0 points of damage to Krogg Boss: 70.0 Krogg: 175.0

Round 6 Krogg does 26.0 points of damage to Boss Boss does 5.0 points of damage to Krogg Boss: 44.0 Krogg: 170.0

Round 7 Krogg does 26.0 points of damage to Boss Boss does 5.0 points of damage to Krogg Boss: 18.0 Krogg: 165.0

Round 8 Krogg does 26.0 points of damage to Boss Boss does 5.0 points of damage to Krogg Boss: -8.0 Krogg: 160.0

Krogg has won. You are victorious! ```

You should test your program with other values, to ensure that all of your logic works properly. If the boss wins, display the following message instead:

``` The Boss has won. You have been defeated! ```

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

What is the difference between needs and wants? (p. 263)

Answered: 1 week ago

Question

Prove that if Σ an is absolutely convergent, then a. an

Answered: 1 week ago

Question

9. How does one write for a blog?

Answered: 1 week ago

Question

4. What are effective practices for user-generated content sites?

Answered: 1 week ago