home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / pascal / P_ROBOTS.ZIP / P-ROBT21.ZOO / ultimo5.pr < prev    next >
Encoding:
Text File  |  1989-10-23  |  3.5 KB  |  121 lines

  1. (**************************************************************************)
  2. (*                             W A R N I N G                              *)
  3. (*                                                                        *)
  4. (*  This Robot has NOT been designed to take advantage of the advanced    *)
  5. (*  features of P-ROBOTS, such as, Shields, Fuel, Teams or Obstructions.  *)
  6. (**************************************************************************)
  7.  
  8. PROCEDURE Ultimo5;
  9.  
  10.                        { This robot takes his tracking and
  11.                          shooting style from the C-Robot by
  12.                          Hortense Endoh, and combines it with
  13.                          the Runner type technique from T.Harnish.
  14.                          The difference is that he stays farther
  15.                          away from walls (like the inside corners
  16.                          of a picture frame) and also crosses the
  17.                          field diagonally. One on one, he's tough.
  18.  
  19.                                       Rick Bross              }
  20.  
  21. VAR
  22.    Deg,Dir,Spd : Integer;
  23. PROCEDURE Shoot(Dir,Spd : Integer);  {Track and shoot}
  24. VAR
  25.    Range : Integer;
  26. BEGIN
  27.    Drive(Dir,Spd);
  28.    Range := Scan(Deg,10);
  29.    IF Range > 39 THEN
  30.       BEGIN
  31.          Cannon(Deg,Range);
  32.          Cannon(Deg,Range);
  33.       END
  34.    ELSE
  35.       BEGIN
  36.          Deg := Deg + 20;
  37.          IF Scan(Deg,10) = 0 THEN
  38.             BEGIN
  39.                Deg := Deg - 40;
  40.                IF Scan(Deg,10) = 0 THEN
  41.                   BEGIN
  42.                      Deg := Deg + 60;
  43.                      IF Scan(Deg,10) = 0 THEN
  44.                         WHILE Scan(Deg,10) = 0 DO
  45.                            Deg := Deg + 20;
  46.                   END;
  47.             END;
  48.          Range := Scan(Deg,10);
  49.          Cannon(Deg-5,Range);
  50.          Cannon(Deg+5,Range);
  51.       END;
  52. END;
  53.  
  54. BEGIN
  55.    Dir := Angle_To(0,999);
  56.    WHILE (Loc_X > 230) AND (Loc_Y < 770) DO {Travel to upper left}
  57.       Shoot(Dir,100); {Shoot the whole way, of course!}
  58.    Drive(Dir,0); {Need this to slow down in time.}
  59.    WHILE (Speed > 50) DO {Slow down}
  60.       Shoot(Dir,0); {Still shooting}
  61.  
  62.    REPEAT {Go down left side}
  63.       WHILE (Loc_Y > 230) DO
  64.          Shoot(270,100);
  65.       Drive(270,0); {Need this to slow down in time}
  66.       WHILE (Speed > 50) DO {Slow down}
  67.          Shoot(270,0);
  68.  
  69.       {Go across bottom}
  70.       WHILE (Loc_X < 770) DO
  71.          Shoot(0,100);
  72.       Drive(0,0);
  73.       WHILE (Speed > 50) DO
  74.          Shoot(0,0);
  75.  
  76.       {Go up right side}
  77.       WHILE (Loc_Y < 770) DO
  78.          Shoot(90,100);
  79.       Drive(90,0);
  80.       WHILE (Speed > 50) DO
  81.          Shoot(90,0);
  82.  
  83.       {Go from upper right to lower left}
  84.       WHILE (Loc_Y > 230) DO
  85.          Shoot(225,100);
  86.       Drive(225,0);
  87.       WHILE (Speed > 50) DO
  88.          Shoot(225,0);
  89.  
  90.       {Go up left side}
  91.       WHILE (Loc_Y < 770) DO
  92.          Shoot(90,100);
  93.       Drive(90,0);
  94.       WHILE (Speed > 50) DO
  95.          Shoot(90,0);
  96.  
  97.       {Go from upper left to lower right}
  98.       WHILE (Loc_X < 770) DO
  99.          Shoot(315,100);
  100.       Drive(315,0);
  101.       WHILE (Speed > 50) DO
  102.          Shoot(315,0);
  103.  
  104.       {Go up right side}
  105.       WHILE (Loc_Y < 770) DO
  106.          Shoot(90,100);
  107.       Drive(90,0);
  108.       WHILE (Speed > 50) DO
  109.          Shoot(90,0);
  110.  
  111.       {Go across top}
  112.       WHILE (Loc_X > 230) DO
  113.          Shoot(180,100);
  114.       Drive(180,0);
  115.       WHILE (Speed > 50) DO
  116.          Shoot(180,0);
  117.  
  118.     UNTIL Dead OR Winner;
  119.  
  120.   END; { End Ultimo Main }
  121.