-
Notifications
You must be signed in to change notification settings - Fork 76
Robotics –– Assignment II: Writing a Behavior
Jiun Kim edited this page Oct 17, 2016
·
7 revisions
Share advice on the behaviors assignment here!
- The following command is pretty useful to find bits of code that could help you:
grep -ir "<string that you want to match for>"
'grep' is a command that searches for a string under the current directory the 'i' flag tells grep to ignore case the 'r' flag tells grep to search subdirectories recursively
so you can issue the command grep -ir "lines"
and the console will output all occurrences of the string "lines" in the codebase
- The robot stores an array of lines it sees in the property:
player.brain.vision.line
player.brain.visionLines(0)
will return the first line in the array of lines.
player.brain.visionLines(0).inner.r
returns the distance to the first line in the array of lines.
- You can make the robot walk using:
player.brain.nav.walk(int x, int y, int z)
- where the x,y,z is the speed robot is moving relative to the robot's position