home *** CD-ROM | disk | FTP | other *** search
- PROCEDURE RUNNER;
-
- {
- Based on C-Robot RUNNER
-
- by T. Harnish
-
- "There I was with my back to the wall..."
-
- Except for pre-positioning, everything is
- inline code and has as few variables as
- possible to make this sucker as fast as
- it can be. Some tweaking of scan width
- might be interesting. The obvious
- disadvantage of this guy is that he can
- never reach a 'bot running on the right
- edge, and could result in a draw if they
- never get within 700 units of each other.
-
-
- }
-
- PROCEDURE GOTO(dest_x, dest_y : Integer); { go to lower left corner }
- BEGIN
- WHILE (distance(loc_x, loc_y, dest_x, dest_y) > 100) DO
- IF (speed = 0) THEN drive(Angle_To(dest_x, dest_y), 100);
-
- drive(0, 0); {i.e., stop}
- WHILE (speed > 0) DO {nothing-- i.e., slow down} ;
- END; { End GoTO }
-
-
- BEGIN { Main routine }
-
-
- GOTO(0, 0); { Go to lower left corner }
-
- REPEAT { Main loop }
- WHILE (loc_y < 850) DO BEGIN { Check for top }
- drive(90, 100); { Go up }
- IF (scan(0, 10) > 0) THEN { Look across }
- cannon(0, scan(0, 10)); { Shoot if you see anything }
- IF (scan(90, 10) > 0) THEN { Look where you are going }
- cannon(90, scan(90, 10)); { Shoot if you see anything }
- IF (scan(270, 10) > 0) THEN { Check your rear }
- cannon(270, scan(270, 10)); { Shoot if you see anything }
- END;
- drive(90, 0); { Near top, slow down }
- WHILE (speed > 50) DO ; { Wait for slow to 50 }
-
- WHILE (loc_y > 150) DO BEGIN { Check for bottom }
- drive(270, 100); { Go down, if you'll pardon the expression }
- IF (scan(0, 10) > 0) THEN { Look across }
- cannon(0, scan(0, 10)); { Shoot, as before }
- IF (scan(270, 10) > 0) THEN { Look where you're going }
- cannon(270, scan(270, 10)); { Shoot, as before }
- IF (scan(90, 10) > 0) THEN { Check your rear }
- cannon(90, scan(90, 10)); { Shoot if you see anything }
- END;
- drive(270, 0); { Slow down }
- WHILE (speed > 50) DO ; { Wait for 50 }
-
- UNTIL Dead OR Winner;
-
- END; { End RUNNER Main }