Пример #1
0
def main():
    print "Dwarf should not keep moving barrels around."

    game = Game((10, 6, 128))
    renderer = Renderer(game)

    game.schedule(Dwarf((3, 3, 64)))

    for i in range(4):
        barrel = Item(Barrel, (8, i, 64), 1.0)
        barrel.contents.append(Item(Beverage, None, Barrel.capacity))
        game.world.additem(barrel)

    game.world.addstockpile(Stockpile([(2, 5, 64)], [Beverage.stocktype]))

    game.world.addstockpile(Stockpile([(4, 5, 64)], [Beverage.stocktype]))

    while not game.done:
        game.step()
        renderer.step()
Пример #2
0
def main():
    print 'Dwarf should store barrel in stockpile, then drink from it.'
    
    game = Game((10,6,128))
    renderer = Renderer(game)

    dwarf = Dwarf((3,3,64))
    dwarf.hydration = 120
    
    game.schedule(dwarf)

    barrel = Item(Barrel, (8,4,64), 1.0)
    barrel.contents.append(Item(Beverage, None, Barrel.capacity))
    game.world.additem(barrel)

    game.world.addstockpile(Stockpile([(2,5,64)], [Beverage.stocktype]))
    
    while not game.done:
        pre = barrel.contents[0].materials[0].amount
        game.step()
        if barrel.contents[0].materials[0].amount != pre:
            print 'Dwarf drank'
        
        renderer.step()