Skip to content

Instantly share code, notes, and snippets.

@midu
Last active August 29, 2015 14:16
Show Gist options
  • Save midu/4c84623f195983f1153a to your computer and use it in GitHub Desktop.
Save midu/4c84623f195983f1153a to your computer and use it in GitHub Desktop.

The most advanced pokemon game, ever.

Implement a pokemon game with three different Pokemons:

  • Bulbasaur, of type Plant.

  • Charmander, of type Fire.

  • Squirtle, of type Water.

  • Each pokemon has 10 points of force, which means that when they attack another pokemon, they deal 10 damage points.

  • Each pokemon has 100 health points.

  • Fire Pokemon attacks do double damage on Plant Pokemons

  • Water Pokemon attacks do double damage on Fire Pokemons

  • Plant Pokemon attacks do double damage on Water Pokemons

This Pokemon game is payed in a Ruby console:

$ irb -I. -rpokemon
squirtle = Squirtle.new
squirtle.hp
# => 100

bulbasaur = Bulbasaur.new
bulbasaur.hp = 100

squirtle.attack(bulbasaur)

bulbasaur.hp
# => 90
squirtle.hp
# => 100

bulbasaur.attack(squirtle)

bulbasaur.hp
# => 90
squirtle.hp
# => 80

How would you implement this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment