コード例 #1
0
                           has_food=False,
                           hungry=True,
                           has_money=True)
    _actions.add_reaction('order_pizza',
                          has_food=True,
                          is_fat=True,
                          has_money=False)
    _actions.add_condition('fetch_money', has_money=False)
    _actions.add_reaction('fetch_money', has_money=True)
    _actions.add_condition('buy_ingredients', has_money=True, in_kitchen=False)
    _actions.add_reaction('buy_ingredients',
                          has_money=False,
                          has_ingredients=True)
    _actions.set_weight('cook', 20)
    _actions.set_weight('order_pizza', 2)
    _actions.set_weight('fetch_money', 20)
    _actions.change_goal('order_pizza', is_fat=False)

    _world.set_action_list(_actions)

    _t = time.time()
    _path = _world.calculate()
    _took_time = time.time() - _t

    passflag = False

    while passflag == False:
        passflag = print_path()

    print '\nTook:', _took_time