Skip to content

Instantly share code, notes, and snippets.

@exelotl
Created November 17, 2018 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exelotl/dd79bdad5b2366ba7a94d27b9e861a34 to your computer and use it in GitHub Desktop.
Save exelotl/dd79bdad5b2366ba7a94d27b9e861a34 to your computer and use it in GitHub Desktop.
Pokemon type matchup table example with labelled items
type PokeType = enum
Fire
Water
Grass
Electric
const matchups: array[Fire..Electric, array[Fire..Electric, float]] = [
Fire: [
Fire: 0.5,
Water: 0.5,
Grass: 2.0,
Electric: 1.0,
],
Water: [
Fire: 2.0,
Water: 0.5,
Grass: 0.5,
Electric: 1.0,
],
Grass: [
Fire: 0.5,
Water: 2.0,
Grass: 0.5,
Electric: 1.0,
],
Electric: [
Fire: 1.0,
Water: 2.0,
Grass: 0.5,
Electric: 0.5,
],
]
echo matchups[Fire][Grass] # 2.0, it's super effective!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment