home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
PASCAL
/
P_ROBO31.ZIP
/
FOO.PR
< prev
next >
Wrap
Text File
|
1989-10-23
|
2KB
|
61 lines
(**************************************************************************)
(* W A R N I N G *)
(* *)
(* This Robot has NOT been designed to take advantage of the advanced *)
(* features of P-ROBOTS, such as, Shields, Fuel, Teams or Obstructions. *)
(**************************************************************************)
PROCEDURE FOO;
{ Based on C-Robot FOO : programmed by OBI-ONE }
VAR
drv_dir : Integer; { drive direction }
scn_dir : Integer; { scan direction }
Range : Integer; { range to oponent }
found : Integer; { foe found ? }
x, y : Integer; { current location }
BEGIN {FOO main}
drv_dir := Random(360); { initialize }
scn_dir := 0;
found := 0;
drive(drv_dir, 100);
WHILE True DO BEGIN { main loop }
{ when close to wall, turn around at random. }
x := loc_x;
IF (x < 200) THEN
drv_dir := Random(90)
ELSE IF (x > 800) THEN
drv_dir := Random(90)+180;
y := loc_y;
IF (y < 200) THEN
drv_dir := Random(90)+90
ELSE IF (y > 800) THEN
drv_dir := Random(90)+270;
drive(drv_dir, 100);
{ scan every 20 degrees resolution. }
{ if foe found, cannon it. }
Range := scan(scn_dir, 10);
IF Range > 0 THEN
BEGIN
found := 1;
cannon(scn_dir, Range);
END
ELSE IF found > 0 THEN
BEGIN
found := 0;
scn_dir := scn_dir-30;
END
ELSE scn_dir := scn_dir+10;
END; { end of main loop }
END; {FOO}