コード例 #1
0
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))
コード例 #2
0
ファイル: play.py プロジェクト: brianshumate/katamari
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))
コード例 #3
0
ファイル: play.py プロジェクト: brianshumate/katamari
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"
コード例 #4
0
ファイル: play.py プロジェクト: shaneriley/katamari
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"