home *** CD-ROM | disk | FTP | other *** search
- PROCEDURE DECOY;
-
- { Based on a C-Robot By Bruce Oberleitner }
-
- { Decoy runs around the field, randomly }
- { and randomly fires. Decoy makes an excellent}
- { practice target to test new robots. }
-
-
- PROCEDURE go(dest_x, dest_y : Integer);
- { go - go to the point specified }
- VAR course : Integer;
- BEGIN
- course := Angle_To(dest_x, dest_y);
- drive(course, 100);
- WHILE (distance(loc_x, loc_y, dest_x, dest_y) > 100)
- DO cannon(Random(360), Random(700)); {fire randomly}
- drive(course, 0);
- WHILE (speed > 0) DO {nothing} ;
- END;
-
-
- BEGIN {Decoy Main}
- REPEAT
- go(1+Random(995), 1+Random(995)); { go somewhere in the field }
- UNTIL Dead OR Winner;
- END; { end of Decoy Main }
-