Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2. A program that simulates a game will be written. There will be three characters available in the game: fire titan, water titan and

image text in transcribed

Question 2. A program that simulates a game will be written. There will be three characters available in the game: fire titan, water titan and earth titan. Simulation will be made by choosing two characters different from each other randomly. The attack types, effects and probabilities of the characters are given as in the table. The energies of the initially selected characters will be considered as 100. After the attack type of the character is determined randomly in each move, the energy of the opponent character will be reduced by the effect of the attack type. The probability of realization of the attack type for characters will be calculated using the random.randint command by adding the library as follows. import random probability = randomrandint (1,100) For example, when the values in the table are examined, if the probability of an attack for the water titan is between 1 and 20 (inclusive), the frigid healing attack type will be used. If it is between 21 and 60 (inclusive), frost needle attack type will be used. In the range of 61 to 100 (inclusive), the north wind attack type will be used. For these attack types, the energy of the opponent will be reduced to 11, 7 and 3, respectively. Similarly, the values in the table will be used for other characters. The first player to reduce their opponent's energy to zero or below zero will win the game. Write this application using the Python programming language. Table Character attack types, effects and probabilities. Character Attack Types Effect Probability Water Titan Frigid Healing 11 20 Water Titan Frost Needles 7 40 Water Titan North Wind 3 40 Fire Titan Herald of Flame 12 10 Fire Titan Crushing Blow 8 40 Fire Titan Erupting Rage 4 50 Earth Titan Subterranean Prison 10 15 Earth Titan Anger of the Earth 6 25 Earth Titan Forest Storm 5 60 Note: Explanation lines should be added for the codes you have prepared in each

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago