def smash_katamari(data): katamari = data["katamari"] for i in range(random.randint(0, min(3, len(katamari["items"])))): item = random.choice(katamari["items"]) printer.lose(item["name"]) katamari["items"].remove(item) loc = data["level"]["location"] data["level"]["grid"][loc[1]][loc[0]].append(item) printer.status(recalc_katamari(data))
def smash_katamari(data): katamari = data["katamari"] for i in range(random.randint(0,min(3, len(katamari["items"])))): item = random.choice(katamari["items"]) printer.lose(item["name"]) katamari["items"].remove(item) loc = data["level"]["location"] data["level"]["grid"][loc[1]][loc[0]].append(item) printer.status(recalc_katamari(data))
def roll(data): place = data["level"]["location"] items = data["level"]["grid"][place[1]][place[0]] item_names = [item["name"].lower() for item in items] to_roll = input("Roll what? ").lower() targets = [item for item in items if item["name"].lower() == to_roll] if len(targets) > 0: item = targets[0] if item["size"] <= recalc_katamari(data) / 2.0: items.remove(item) data["katamari"]["items"].append(item) printer.pickup(item["name"]) printer.status(recalc_katamari(data)) else: printer.fail(item["name"]) smash_katamari(data) tick_time(data) else: print "I'm sorry, I don't see that item here"