home *** CD-ROM | disk | FTP | other *** search
- PROCEDURE SLANT6;
-
- {
- Based on C-Robot SLANT6
-
- by T. Harnish
-
- This guy is a logical extension of RUNNER.
- By running on the diagonal less of the field
- is out of range.
-
- }
-
- PROCEDURE GOTO(dest_x, dest_y : Integer);
- 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(5, 995); { Go to upper left corner }
-
- REPEAT { Main loop }
-
- WHILE (loc_y > 150) DO { Check for bottom }
- BEGIN
- drive(315, 100); { Go diagonally down and right }
- IF (scan(0, 10) > 0) THEN { Look right }
- cannon(0, scan(0, 10)); { Shoot if you see anything }
- IF (scan(90, 10) > 0) THEN { Look up }
- cannon(90, scan(90, 10)); { Shoot if you see anything }
- IF (scan(270, 10) > 0) THEN { Look down }
- cannon(270, scan(270, 10)); { Shoot if you see anything }
- IF (scan(180, 10) > 0) THEN { Look left }
- cannon(180, scan(180, 10)); { Shoot if you see anything }
- END;
-
- drive(315, 0); { Near bottom, slow down }
- WHILE (speed > 50) DO ; { Wait for slow to 50 }
-
- WHILE (loc_y < 850) DO { Check for top }
- BEGIN
- drive(135, 100); { Go diagonally up and left }
- IF (scan(0, 10) > 0) THEN { Look right }
- cannon(0, scan(0, 10)); { Shoot, as before }
- IF (scan(270, 10) > 0) THEN { Look down }
- cannon(270, scan(270, 10)); { Shoot, as before }
- IF (scan(90, 10) > 0) THEN { Look up }
- cannon(90, scan(90, 10)); { Shoot if you see anything }
- IF (scan(180, 10) > 0) THEN { Look left }
- cannon(180, scan(180, 10)); { Shoot if you see anything }
- END;
-
- drive(135, 0); { Slow down }
- WHILE (speed > 50) DO ; { Wait for 50 }
-
- UNTIL Dead OR Winner;
-
- END; { End SLANT6 Main }
-