Skip to content

Instantly share code, notes, and snippets.

@exelotl

exelotl/pkmn.nim Secret

Last active November 17, 2018 23:40
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/673d8258e697ddb2cd56af5bab9180bb to your computer and use it in GitHub Desktop.
Save exelotl/673d8258e697ddb2cd56af5bab9180bb to your computer and use it in GitHub Desktop.
Pokemon type matchup table example
type PokeType = enum
Fire
Water
Grass
Electric
const matchups: array[Fire..Electric, array[Fire..Electric, float]] = [
[0.5, 0.5, 2.0, 1.0],
[2.0, 0.5, 0.5, 1.0],
[0.5, 2.0, 0.5, 1.0],
[1.0, 2.0, 0.5, 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