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
left_and_distant_bit?()
click to toggle source
def left_and_distant_bit?
@@left_range3.include? Angles.normalize(@target.getPhi())
end
left_and_distant_less?()
click to toggle source
def left_and_distant_less?
@@left_range2.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()
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)
return get_skill("step_left")
elsif(@target.getX > @@x2)
return get_skill("step_right")
else
return get_skill("walk_slow")
end
elsif(@target.getY > @@y2)
if(@target.getX < -@@x2)
return get_skill("step_left")
elsif(@target.getX > @@x2)
return get_skill("step_right")
else
return nil
end
elsif(@target.getY < 0)
if(@target.getX < -@@x2)
return get_skill("walk_back")
elsif(@target.getX > @@x2)
return get_skill("walk_back")
elsif(@target.getX > 0)
return get_skill("step_right")
else
return get_skill("step_left")
end
else
return get_skill("walk_back")
end
else
if(straight?)
return get_skill("walk_forward")
elsif(right_and_distant?)
return get_skill("turn_right_45")
elsif(right_and_distant_less?)
return get_skill("turn_right_cont_20")
elsif(right_and_distant_bit?)
return get_skill("turn_right_cont_20")
elsif(left_and_distant?)
return get_skill("turn_left_45")
elsif(left_and_distant_less?)
return get_skill("turn_left_cont_20")
elsif(left_and_distant_bit?)
return get_skill("turn_left_cont_20")
else
@agentInfo.loguj("olalaa")
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
right_and_distant_bit?()
click to toggle source
def right_and_distant_bit?
@@right_range3.include? Angles.normalize(@target.getPhi())
end
right_and_distant_less?()
click to toggle source
def right_and_distant_less?
@@right_range2.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