class WalkOld

Public Class Methods

new(target) click to toggle source
Calls superclass method RubyHighSkill.new
# File high_skills/walkOld.rb, line 21
def initialize target
  super()
  @target = target
end

Public Instance Methods

abs(number) click to toggle source
# File high_skills/walkOld.rb, line 104
def abs number
  Math.abs number
end
back?(target_position) click to toggle source

def on_ground?

AgentModel.getInstance.position.getZ < 0.5

end

# File high_skills/walkOld.rb, line 71
def back? target_position
  Angles.angle_diff(target_position.phi, Math::PI) < Math::PI / 6.0
end
back_and_left?(target_position) click to toggle source
# File high_skills/walkOld.rb, line 79
def back_and_left? target_position
  Angles.angle_diff(target_position.phi, Math::PI) < Math::PI / 6.0 and @@right_range.include?(Angles.normalize(target_position.phi))
end
back_and_right?(target_position) click to toggle source
# File high_skills/walkOld.rb, line 75
def back_and_right? target_position
  Angles.angle_diff(target_position.phi, Math::PI) < Math::PI / 6.0 and @@right_range.include?(Angles.normalize(target_position.phi))
end
ball_unseen() click to toggle source
# File high_skills/walkOld.rb, line 108
def ball_unseen
  EnvironmentModel.SIMULATION_TIME - WorldModel.getInstance.getBall.getLastTimeSeen()
end
checkProgress() click to toggle source
# File high_skills/walkOld.rb, line 100
  def checkProgress
#    raise "Fallen!" if me.on_ground?
  end
close_enough?(target_position) click to toggle source
# File high_skills/walkOld.rb, line 59
def close_enough? target_position
  target_position.r < 0.0
end
left_and_close?(target_position) click to toggle source
# File high_skills/walkOld.rb, line 83
def left_and_close? target_position
  puts target_position
  (target_position.r <= @@strafe_distance) and @@left_strafe_range.include?(Angles.normalize(target_position.phi))
end
left_and_distant?(target_position) click to toggle source
# File high_skills/walkOld.rb, line 92
def left_and_distant? target_position
  @@left_range.include?(Angles.normalize(target_position.phi))
end
pickLowSkill() click to toggle source
# File high_skills/walkOld.rb, line 26
def pickLowSkill
  target_position = @target
  if @target == :ball then
      target_position = (ball relative position)
  else
      target_position = AgentModel.getInstance.relativize @target
  end
  
  #puts 'moviing this>'
  #puts target_position
  
  target_position = target_position.set_z(0.0)
  #puts 'going to'
  #puts target_position
  #puts 'going to'
  return nil if close_enough?(target_position)
  return nil if EnvironmentModel.beamablePlayMode
  #puts AgentModel.getInstance.position.getZ
      #return get_skill("stand_back") if me.on_ground?
      return nil if me.on_ground?
      
      return nil if ball_unseen > 3
  return get_skill("walk_forward") if straight?(target_position)
  #return get_skill("turn_left_90") if back_and_left?(target_position)
  #return get_skill("turn_right_90") if back_and_right?(target_position)
  #return get_skill("step_left") if left_and_close?(target_position)
  #puts '4'
  #return get_skill("step_right") if right_and_close?(target_position)
  #puts '5'
  return get_skill("turn_left_cont_20") if left_and_distant?(target_position)
  return get_skill("turn_right_cont_20") if right_and_distant?(target_position)
end
right_and_close?(target_position) click to toggle source
# File high_skills/walkOld.rb, line 88
def right_and_close? target_position
  (target_position.r <= @@strafe_distance) and @@right_strafe_range.include?(Angles.normalize(target_position.phi))
end
right_and_distant?(target_position) click to toggle source
# File high_skills/walkOld.rb, line 96
def right_and_distant? target_position
  @@right_range.include?(Angles.normalize(target_position.phi))
end
straight?(target_position) click to toggle source
# File high_skills/walkOld.rb, line 63
def straight? target_position
  Angles.angle_diff(target_position.phi, 0.0) < Math::PI / 6.0 
end