kyu_6.pokemon_damage_calculator package

Submodules

kyu_6.pokemon_damage_calculator.calculate_damage module

kyu_6.pokemon_damage_calculator.calculate_damage.calculate_damage(your_type: str, opponent_type: str, attack, defense) → int[source]

It’s a Pokemon battle! Your task is to calculate the damage that a particular move would do using the following formula (not the actual one from the game):

damage = 50 * (attack / defense) * effectiveness

Parameters
  • your_type

  • opponent_type

  • attack

  • defense

Returns

kyu_6.pokemon_damage_calculator.calculate_damage.effectiveness(your_type: str, opponent_type: str) → float[source]

Effectiveness:

Super effective: 2x damage Neutral: 1x damage Not very effective: 0.5x damage

To prevent this kata from being tedious, you’ll only be dealing with four types: fire, water, grass, and electric. Here is the effectiveness of each match-up:

fire > grass fire < water fire = electric water < grass water < electric grass = electric

Parameters
  • your_type

  • opponent_type

Returns

kyu_6.pokemon_damage_calculator.test_calculate_damage module

class kyu_6.pokemon_damage_calculator.test_calculate_damage.CalculateDamageTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Testing calculate_damage function: damage = 50 * (attack / defense) * effectiveness

test_calculate_damage()[source]

Module contents