Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(b) Now that you have a function that casts a spell at another wizard, it's time to come up with a strategy for each wizard

image text in transcribed
(b) Now that you have a function that casts a spell at another wizard, it's time to come up with a strategy for each wizard as to who to cast a spell to. (An obvious strategy is for each wizard to cast a spell towards the most powerful wand still active, since that player has the best chance of hitting back and winning). Define an int function named startDuel () that uses the spell function above to simulate an entire duel using the chosen strategy. It should loop until only one player is left, invoking the spell function for each wizard in order (Angela, Cedric, Eloise) with an opponent and a probability of successfully rendering the opponent unconscious, according to who is casting the spell. The function should return a value that indicates who won the duel -1 if Angela wins the duel, 2 if Cedric wins, and 3 if Eloise wins

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

How does artificial intelligence improve product promotion?

Answered: 1 week ago