예제 #1
0
def hockeyist_can_strike_unit(env, hockeyist, unit):
    distance = geometry.distance(hockeyist, unit)
    angle = geometry.unit_angle_to(hockeyist, unit)

    return distance <= env.game.stick_length and abs(angle) <= env.game.stick_sector / 2.
예제 #2
0
def hockeyist_can_take_puck(env, hockeyist):
    distance = geometry.distance(hockeyist, env.world.puck)
    angle = geometry.unit_angle_to(hockeyist, env.world.puck)

    return distance <= env.game.stick_length and abs(angle) <= env.game.stick_sector / 2.