Exemplo n.º 1
0
def get_action(wm: World):
    print("self_pos:", wm.self().pos())
    print("ball_pos:", wm.ball().pos())
    if is_kickable(wm.self(), wm):
        return do_move(wm)
    return do_kick(wm)
Exemplo n.º 2
0
def is_kickable(agent: Agent, wm: World) -> bool:
    print("dist:", agent.pos().dist(wm.ball().pos()), ", ", agent.kickable_r)
    if agent.pos().dist(wm.ball().pos()) > agent.kickable_r:
        return False
    return True
Exemplo n.º 3
0
def do_kick(wm: World):
    return KickToPoint(Vector2D(0, 0), 1).execute(wm.self())
Exemplo n.º 4
0
def do_move(wm: World):
    return GoToPoint(Vector2D(0, 0), 1).execute(wm.self())
Exemplo n.º 5
0
def is_kickable(agent: Agent, wm: World) -> bool:
    if agent.pos().dist(wm.ball().pos()) > agent.kickable_r:
        return False
    return True
Exemplo n.º 6
0
def get_action(wm: World):
    # if wm.self_id != 1:
    #     return do_move2(wm)
    if is_kickable(wm.self(), wm):
        return do_kick(wm)
    return do_move(wm)
Exemplo n.º 7
0
def do_move2(wm: World):
    return GoToPoint(Vector2D(250, 150), 1).execute(wm.self())