class MetroidState: def __init__(self): self.itemsCollected = { "Maru Mari": False, "Bombs": False, "Long Beam": False, "Ice Beam": False, "Wave Beam": False, "High Jump Boots": False, "Varia": False, "Screw Attack": False } self.samusHas = { "Maru Mari": False, "Bombs": False, "Long Beam": False, "Ice Beam": False, "Wave Beam": False, "High Jump Boots": False, "Varia": False, "Screw Attack": False } self.missileTanks = { 1: False, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False, 8: False, 9: False, 10: False, 11: False, 12: False, 13: False, 14: False, 15: False, 16: False, 17: False, 18: False, 19: False, 20: False, 21: False } self.energyTanks = { 1: False, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False, 8: False } self.zebetitesDestroyed { 1: False, 2: False, 3: False, 4: False, 5: False } self.doors { "Brinstar": { 1: False, 2: False, 3: False, 4: False, 5: False }, "Norfair": { 1: False, 2: False, 3: False, 4: False }, "Kraid": { 1: False, 2: False, 3: False, 4: False, 5: False }, "Ridley": { 1: False, 2: False }, "Tourian" { 1: False, 2: False, 3: False } } self.kraidKilled = False self.ridleyKilled = False self.motherBrainKilled = False self.kraidStatue = False self.ridleyStatue = False self.swimsuit = False self.missileCount = 0 self.gameAge = 0 self.locations = ["Brinstar", "Norfair", "Kraid's Lair", "Ridley's Lair", "Tourian"] self.startLocation = 0 def toggleItem(self, itm): if itm in self.itemsCollected.keys(): self.itemsCollected[itm] = not self.itemsCollected[itm] self.samusHas[itm] = not self.samusHas[itm] else: print("Couldn't find item: {}".format(str(itm))) def toggleMissileTank(self, num): try: num = int(num) except: print("{} is not a number".format(num)) return if num in self.missileTanks.keys(): self.missileTanks[num] = not self.missileTanks[num] else: print("Couldn't find missile tank: {}".format(num)) def toggleEnergyTank(self, num): try: num = int(num) except: print("{} is not a number".format(num)) return if num in self.energyTanks.keys(): self.energyTanks[num] = not self.energyTanks[num] else: print("Couldn't find energy tank: {}".format(num)) def toggleZebetite(self, num): try: num = int(num) except: print("{} is not a number".format(num)) return if num in self.zebetitesDestroyed.keys(): self.zebetitesDestroyed[num] = not self.zebetitesDestroyed[num] else: print("Couldn't find Zebetite: {}".format(num)) def toggleKraid(self): self.kraidKilled = not self.kraidKilled self.kraidStatue = self.kraidKilled def toggleKraidStatue(self): self.kraidStatue = not self.kraidStatue if self.kraidKilled and not self.kraidStatue: print("WARNING: Kraid has been killed but his statue has not been raised.") def toggleRidley(self): self.ridleyKilled = not self.ridleyKilled self.ridleyStatue = self.ridleyKilled def toggleRidleyStatue(self): self.ridleyStatue = not self.ridleyStatue if self.ridleyKilled and not self.ridleyStatue: print("WARNING: Ridley has been killed but his statue has not been raised.") def toggleMotherBrain(self): self.motherBrainKilled = not self.motherBrainKilled def toggleDoor(self, area, door) { try: area = str(area) door = int(door) except: print("Area must be string, door must be a positive integer") return if area in self.doors.keys() and int(door) in self.doors[area].keys(): self.doors[area][door] = not self.doors[area][door] else: print("Couldn't find door {} in area {}".format(door, area)) } def toggleSwimsuit(self): self.swimsuit = not self.swimsuit def newLocation(self, loc): try: loc = str(loc) except: print("Location must be a string") return if loc in self.locations: self.startLocation = self.locations.index(loc) else: print("Couldn't find location: {}".format(loc)) def uncollectedItems(self): o = [] for k,v in self.itemsCollected.items(): if v == True: o.append(k) return ", ".join(o) def toString(self): ic = "Items Collected: {}".format(self.uncollectedItems()) def main(): gs = MetroidState() if __name__ == "__main__": main()