User Tools

Site Tools


cs175:robocode_lab_-_cornerbot2

CornerBot2


Create a robocode robot called CornerBot2 that does the following:

  • Visit each corner of the battlefield.
  • The order in which the corners are visited does not matter.
  • Another possible algorithm
    • Turn robot left until heading is an angle that is a multiple of 90º.
      • Use the modulus operator (%).
      • Get initial heading of robot.
      • Angle to turn left is ((initial heading) % 90).
        • “How many 90º angles can fit in my initial heading?”
      • Turn left to a heading that is a multiple of 90º.
    • Go ahead until I hit wall.
    • Make a 90º right turn
    • Repeat above 2 steps until I've reached all corners.

See this robot's source code.


cs175/robocode_lab_-_cornerbot2.txt · Last modified: 2014/10/02 20:22 by jchung

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki