Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3 : As indicated by the table in Problem 2 , Pokemon have a given type and on occasion, a secondary type. Every Pokemon

Problem 3:
As indicated by the table in Problem 2, Pokemon have a given type and on occasion, a secondary type. Every Pokemon also has an associated attack value.
In this problem, we will work with something called a modified attack value. The attack value of a Pokemon is changed according to the following rules:
if the first type is normal, add 5 to the attack value
if the first type is anything other than normal, add 10 to the attack value
if the Pokemon also has a secondary type, increate the attack value by an additional 20 points
Design a function that accepts a Pokemon ID number and returns the modified attack value.
When designing your function, be sure to follow all steps of the HtDF recipe including designing your tests first.
Problem 4:
In one-on-one battle, an attacking Pokemon inflicts damage if its modified attack is strictly greater than the other Pokemon's defense. Given the ID of the
attacking Pokemon and the ID of the defending Pokemon, design a function to determine if the attacking Pokemon inflicts damage.
For this problem, you should consider the attack of a Pokemon as its modified attack as calculated in Problem 3.
When designing your function, be sure to follow all steps of the HtDF recipe including designing your tests first.Problem 5
Finally, we will write a function that tells the outcome of a battle between two Pokemon, based on the result of the function designed for Problem 4. Given two
Pokemon IDs, the message should read:
"Name1 has succesfully attacked Name2!"
if the attack is succesful. Otherwise, the message should read:
"Name2 has deflected the attack from Name1!"
(Name1 and Name2 are placeholders for the actual names of the Pokemon, based on their ID)
Checkpoints
This function must call the function designed in Problem 4. When designing your function, be sure to follow all steps of the HtDF recipe including designing your tests first. Here are some functions of interest:
get_pokemon_name(pokemon_id: int) str
get_pokemon_attack(pokemon_name: str) int
get_pokemon_defense(pokemon_name: str) int
get_pokemon_height(pokemon_name: str) int
get_pokemon_weight(pokemon_name: str) int
get_pokemon_num_types(pokemon_name: str) int
get_pokemon_type1(pokemon_name: str) str
get_pokemon_type2(pokemon_name: str) str
image text in transcribed

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

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

ISBN: 3642341780, 978-3642341786

More Books

Students also viewed these Databases questions

Question

4. Explain the strengths and weaknesses of each approach.

Answered: 1 week ago