Answered step by step
Verified Expert Solution
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
(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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started