abs(number)
click to toggle source
def abs number
Math.abs number
end
checkProgress()
click to toggle source
close_enough?()
click to toggle source
def close_enough?
@agentInfo.isBallMine()
end
is_ball_mine?()
click to toggle source
def is_ball_mine?
return @agentInfo.getIsBallMine
end
left_and_distant?()
click to toggle source
def left_and_distant?
@@left_range.include? Angles.normalize(@target.getPhi())
end
near_ball?()
click to toggle source
def near_ball?
@agentInfo.nearBall()
end
pickLowSkill()
click to toggle source
def pickLowSkill
is_still_valid = @validity_proc.call
@ending = true if not is_still_valid
return nil if not is_still_valid or @ending
@agentInfo = Java::sk.fiit.jim.agent.AgentInfo.getInstance
@target = @agentInfo.ballControlPosition()
@target_position_phi = @target.getPhi()
@kick_target_phi = @kick_target.getPhi()
if @target_position_phi != nil
@target_position_phi2 = @target_position_phi
elsif @target_position_phi == nil and plan.see_ball?
@target_position_phi = @target_position_phi2
end
if (me.on_ground? or me.lying_on_back? or me.lying_on_belly?) :
return nil
elsif (not see_ball?)
return nil
else
if(@target.getR() < @@close_distance)
if(@target.getY > @@y1)
if(@target.getX < -@@x2)
@agentInfo.loguj("ZONA 3")
@agentInfo.loguj("step_left")
return get_skill("step_left")
elsif(@target.getX > @@x2)
@agentInfo.loguj("ZONA 2")
@agentInfo.loguj("step_right")
return get_skill("step_right")
else
@agentInfo.loguj("ZONA 1")
@agentInfo.loguj("walk_slow")
return get_skill("walk_slow2")
end
elsif(@target.getY > @@y2)
if(@target.getX < -@@x2)
@agentInfo.loguj("ZONA 3")
@agentInfo.loguj("step_left")
return get_skill("step_left")
elsif(@target.getX > @@x2)
@agentInfo.loguj("ZONA 2")
@agentInfo.loguj("step_right")
return get_skill("step_right")
else
return nil
end
elsif(@target.getY < 0)
if(@target.getX < -@@x2)
@agentInfo.loguj("ZONA 4")
@agentInfo.loguj("walk_back")
return get_skill("walk_back")
elsif(@target.getX > @@x2)
@agentInfo.loguj("ZONA 5")
@agentInfo.loguj("walk_back")
return get_skill("walk_back")
elsif(@target.getX > 0)
@agentInfo.loguj("ZONA 7")
@agentInfo.loguj("step_right")
return get_skill("step_right")
else
@agentInfo.loguj("ZONA 8")
@agentInfo.loguj("step_left")
return get_skill("step_left")
end
else
@agentInfo.loguj("ZONA 6")
@agentInfo.loguj("walk_back")
return get_skill("walk_back")
end
else
if(straight?)
@agentInfo.loguj("walk_fast")
get_skill("walk_forward")
elsif(right_and_distant?)
@agentInfo.loguj("vpravo_daleko ")
return get_skill("step_circ_right_small")
elsif(left_and_distant?)
@agentInfo.loguj("vlavo_daleko ")
return get_skill("step_circ_left_small")
else
return get_skill("rollback")
end
end
end
end
right_and_distant?()
click to toggle source
def right_and_distant?
@@right_range.include? Angles.normalize(@target.getPhi())
end
see_ball?()
click to toggle source
def see_ball?
ball.notSeenLongTime() < 5
end
straight?()
click to toggle source
def straight?
(@@straight_range1.include?(@target_position_phi) or @@straight_range2.include?(@target_position_phi))
end