[Solved] Implement the getEffectiveness method on the Move class

$25

File Name: Implement_the_getEffectiveness_method_on_the_Move_class.zip
File Size: 518.1 KB

SKU: [Solved] Implement the getEffectiveness method on the Move class Category: Tag:
5/5 - (1 vote)
  1. implement the getEffectiveness method on the Move class.
  2. how a type of a Move affects a type of a Pokemon see this chart: http://bulbapedia.bulbagarden.net/wiki/Type/Type_chart (Attack types are on the left and defending types are on the top.) Use whatever generation you see fit.
  3. design this in various ways. free to choose any design best fits. Below are some of possible ways to implement the method.

Design 1 Hard-coding the Type relationship

write a giant chain of if else statements. For example, since normal type of attack has multiplier of 1 against normal type of pokemon, the method would contain a if statement checking if move and pokemon both have NORMAL type and return 1. And there would be such statement for all possible combinations

Design 2 Pokemon Type interface

Similar to the Rock Paper Scissors example, instead of using Enumeration to represent Types, create a Type interface and 15 different Type classes the inherit from the Type interface, e.g. Normal would be a class that implements Type interface. And have those individual classes have a method that determine its effectiveness against other Types. And the getEffectiveness method would use the Type classes do the work of determining the effectiveness.

Design 3 Pokemon Type Chart datatype

Create a set of lookup tables (HashMap) that returns the effectiveness between two types. For example: Map normalAttack = new HashMap<>();

normalAttack.put(Type.NORMAL, 1);

normalAttack.put(Type.ROCK, 0.5);

Design 4: free choice

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Implement the getEffectiveness method on the Move class
$25