import random

class Species():
    def __init__(self, name, hex):
        self.name = name
        self.hex = hex

    def __str__(self):
        return self.name

    @staticmethod
    def fromBytes(hex):
        return Species.reverse[hex]

    @staticmethod
    def buildReverse():
        reverse = {}
        Species.members = [attr for attr in dir(Species) if not callable(getattr(Species, attr)) and not attr.startswith("__")]
        for member in Species.members:
            species = getattr(Species, member)
            reverse[species.hex] = species

        Species.reverse = reverse

    @staticmethod
    def rnd():
        return getattr(Species, random.choice(Species.members))

Species.RHYDON = Species("Rhydon", 0x01)
Species.KANGASKHAN = Species("Kangaskhan", 0x02)
Species.NIDORAN_M = Species("Nidoran M", 0x03)
Species.CLEFAIRY = Species("Clefairy", 0x04)
Species.SPEAROW = Species("Spearow", 0x05)
Species.VOLTORB = Species("Voltorb", 0x06)
Species.NIDOKING = Species("Nidoking", 0x07)
Species.SLOWBRO = Species("Slowbro", 0x08)
Species.IVYSAUR = Species("Ivysaur", 0x09)
Species.EXEGGUTOR = Species("Exeggutor", 0x0A)
Species.LICKITUNG = Species("Lickitung", 0x0B)
Species.EXEGGCUTE = Species("Exeggcute", 0x0C)
Species.GRIMER = Species("Grimer", 0x0D)
Species.GENGAR = Species("Gengar", 0x0E)
Species.NIDORAN_F = Species("Nidoran F", 0x0F)
Species.NIDOQUEEN = Species("Nidoqueen", 0x10)
Species.CUBONE = Species("Cubone", 0x11)
Species.RHYHORN = Species("Rhyhorn", 0x12)
Species.LAPRAS = Species("Lapras", 0x13)
Species.ARCANINE = Species("Arcanine", 0x14)
Species.MEW = Species("Mew", 0x15)
Species.GYARADOS = Species("Gyarados", 0x16)
Species.SHELLDER = Species("Shellder", 0x17)
Species.TENTACOOL = Species("Tentacool", 0x18)
Species.GASTLY = Species("Gastly", 0x19)
Species.SCYTHER = Species("Scyther", 0x1A)
Species.STARYU = Species("Staryu", 0x1B)
Species.BLASTOISE = Species("Blastoise", 0x1C)
Species.PINSIR = Species("Pinsir", 0x1D)
Species.TANGELA = Species("Tangela", 0x1E)
Species.GROWLITHE = Species("Growlithe", 0x21)
Species.ONIX = Species("Onix", 0x22)
Species.FEAROW = Species("Fearow", 0x23)
Species.PIDGEY = Species("Pidgey", 0x24)
Species.SLOWPOKE = Species("Slowpoke", 0x25)
Species.KADABRA = Species("Kadabra", 0x26)
Species.GRAVELER = Species("Graveler", 0x27)
Species.CHANSEY = Species("Chansey", 0x28)
Species.MACHOKE = Species("Machoke", 0x29)
Species.MR_MIME = Species("Mr. Mime", 0x2A)
Species.HITMONLEE = Species("Hitmonlee", 0x2B)
Species.HITMONCHAN = Species("Hitmonchan", 0x2C)
Species.ARBOK = Species("Arbok", 0x2D)
Species.PARASECT = Species("Parasect", 0x2E)
Species.PSYDUCK = Species("Psyduck", 0x2F)
Species.DROWZEE = Species("Drowzee", 0x30)
Species.GOLEM = Species("Golem", 0x31)
Species.MAGMAR = Species("Magmar", 0x33)
Species.ELECTABUZZ = Species("Electabuzz", 0x35)
Species.MAGNETON = Species("Magneton", 0x36)
Species.KOFFING = Species("Koffing", 0x37)
Species.MANKEY = Species("Mankey", 0x39)
Species.SEEL = Species("Seel", 0x3A)
Species.DIGLETT = Species("Diglett", 0x3B)
Species.TAUROS = Species("Tauros", 0x3C)
Species.FARFETCHD = Species("Farfetch'd", 0x40)
Species.VENONAT = Species("Venonat", 0x41)
Species.DRAGONITE = Species("Dragonite", 0x42)
Species.DODUO = Species("Doduo", 0x46)
Species.POLIWAG = Species("Poliwag", 0x47)
Species.JYNX = Species("Jynx", 0x48)
Species.MOLTRES = Species("Moltres", 0x49)
Species.ARTICUNO = Species("Articuno", 0x4A)
Species.ZAPDOS = Species("Zapdos", 0x4B)
Species.DITTO = Species("Ditto", 0x4C)
Species.MEOWTH = Species("Meowth", 0x4D)
Species.KRABBY = Species("Krabby", 0x4E)
Species.VULPIX = Species("Vulpix", 0x52)
Species.NINETALES = Species("Ninetales", 0x53)
Species.PIKACHU = Species("Pikachu", 0x54)
Species.RAICHU = Species("Raichu", 0x55)
Species.DRATINI = Species("Dratini", 0x58)
Species.DRAGONAIR = Species("Dragonair", 0x59)
Species.KABUTO = Species("Kabuto", 0x5A)
Species.KABUTOPS = Species("Kabutops", 0x5B)
Species.HORSEA = Species("Horsea", 0x5C)
Species.SEADRA = Species("Seadra", 0x5D)
Species.SANDSHREW = Species("Sandshrew", 0x60)
Species.SANDSLASH = Species("Sandslash", 0x61)
Species.OMANYTE = Species("Omanyte", 0x62)
Species.OMASTAR = Species("Omastar", 0x63)
Species.JIGGLYPUFF = Species("Jigglypuff", 0x64)
Species.WIGGLYTUFF = Species("Wigglytuff", 0x65)
Species.EEVEE = Species("Eevee", 0x66)
Species.FLAREON = Species("Flareon", 0x67)
Species.JOLTEON = Species("Jolteon", 0x68)
Species.VAPOREON = Species("Vaporeon", 0x69)
Species.MACHOP = Species("Machop", 0x6A)
Species.ZUBAT = Species("Zubat", 0x6B)
Species.EKANS = Species("Ekans", 0x6C)
Species.PARAS = Species("Paras", 0x6D)
Species.POLIWHIRL = Species("Poliwhirl", 0x6E)
Species.POLIWRATH = Species("Poliwrath", 0x6F)
Species.WEEDLE = Species("Weedle", 0x70)
Species.KAKUNA = Species("Kakuna", 0x71)
Species.BEEDRILL = Species("Beedrill", 0x72)
Species.DODRIO = Species("Dodrio", 0x74)
Species.PRIMEAPE = Species("Primeape", 0x75)
Species.DUGTRIO = Species("Dugtrio", 0x76)
Species.VENOMOTH = Species("Venomoth", 0x77)
Species.DEWGONG = Species("Dewgong", 0x78)
Species.CATERPIE = Species("Caterpie", 0x7B)
Species.METAPOD = Species("Metapod", 0x7C)
Species.BUTTERFREE = Species("Butterfree", 0x7D)
Species.MACHAMP = Species("Machamp", 0x7E)
Species.GOLDUCK = Species("Golduck", 0x80)
Species.HYPNO = Species("Hypno", 0x81)
Species.GOLBAT = Species("Golbat", 0x82)
Species.MEWTWO = Species("Mewtwo", 0x83)
Species.SNORLAX = Species("Snorlax", 0x84)
Species.MAGIKARP = Species("Magikarp", 0x85)
Species.MUK = Species("Muk", 0x88)
Species.KINGLER = Species("Kingler", 0x8A)
Species.CLOYSTER = Species("Cloyster", 0x8B)
Species.ELECTRODE = Species("Electrode", 0x8D)
Species.CLEFABLE = Species("Clefable", 0x8E)
Species.WEEZING = Species("Weezing", 0x8F)
Species.PERSIAN = Species("Persian", 0x90)
Species.MAROWAK = Species("Marowak", 0x91)
Species.HAUNTER = Species("Haunter", 0x93)
Species.ABRA = Species("Abra", 0x94)
Species.ALAKAZAM = Species("Alakazam", 0x95)
Species.PIDGEOTTO = Species("Pidgeotto", 0x96)
Species.PIDGEOT = Species("Pidgeot", 0x97)
Species.STARMIE = Species("Starmie", 0x98)
Species.BULBASAUR = Species("Bulbasaur", 0x99)
Species.VENUSAUR = Species("Venusaur", 0x9A)
Species.TENTACRUEL = Species("Tentacruel", 0x9B)
Species.GOLDEEN = Species("Goldeen", 0x9D)
Species.SEAKING = Species("Seaking", 0x9E)
Species.PONYTA = Species("Ponyta", 0xA3)
Species.RAPIDASH = Species("Rapidash", 0xA4)
Species.RATTATA = Species("Rattata", 0xA5)
Species.RATICATE = Species("Raticate", 0xA6)
Species.NIDORINO = Species("Nidorino", 0xA7)
Species.NIDORINA = Species("Nidorina", 0xA8)
Species.GEODUDE = Species("Geodude", 0xA9)
Species.PORYGON = Species("Porygon", 0xAA)
Species.AERODACTYL = Species("Aerodactyl", 0xAB)
Species.MAGNEMITE = Species("Magnemite", 0xAD)
Species.CHARMANDER = Species("Charmander", 0xB0)
Species.SQUIRTLE = Species("Squirtle", 0xB1)
Species.CHARMELEON = Species("Charmeleon", 0xB2)
Species.WARTORTLE = Species("Wartortle", 0xB3)
Species.CHARIZARD = Species("Charizard", 0xB4)
Species.ODDISH = Species("Oddish", 0xB9)
Species.GLOOM = Species("Gloom", 0xBA)
Species.VILEPLUME = Species("Vileplume", 0xBB)
Species.BELLSPROUT = Species("Bellsprout", 0xBC)
Species.WEEPINBELL = Species("Weepinbell", 0xBD)
Species.VICTREEBEL = Species("Victreebel", 0xBE)

Species.buildReverse()
