home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 2 / CDPD_II_2352.bin / scope / 126-150 / scopedisk128 / crobots23 / ninja.r < prev    next >
Text File  |  1992-10-27  |  1KB  |  66 lines

  1. Bugaboo Inc.
  2. The Mad Doctor
  3. /* ninja reverse thorin */
  4.  
  5. /* only one routine !! */
  6. main()
  7. {
  8.      int    Dir,Range;
  9.  
  10.      Dir=Range=0;
  11.      while (1) /* main loop */
  12.      {
  13.           drive(rand(360),100);
  14.           while (!(Range=scan(Dir,10)))
  15.                Dir += 20;
  16.  
  17.           if (!speed())
  18.              while (!speed())
  19.                    drive(rand(360,100));
  20.  
  21.           Dir -= 20;
  22.  
  23.           while (!(Range=scan(Dir,5)))
  24.                Dir += 5;
  25.  
  26.           while (speed() > 49)
  27.           {
  28.                 cannon(Dir,Range);
  29.                 drive(Dir,0);
  30.  
  31.           }
  32.  
  33.           drive(Dir+180,100);
  34.  
  35.           while (Range = scan(Dir,5))
  36.           {
  37.                 while (Range = scan(Dir,5))
  38.                       cannon(Dir,Range);
  39.  
  40.                 if (Range = scan(Dir, 10))
  41.                 {
  42.                      int k;
  43.  
  44.                      Dir -= 10;
  45.                      k = Dir;
  46.                      while ((!(Range = scan(Dir,5))) &&
  47.                             (Dir - k <= 30))
  48.                            Dir += 5;  /* fine tuning */
  49.  
  50.                      while (speed() > 49)
  51.                            drive(Dir+180,0);
  52.  
  53.                      drive(Dir, 100);
  54.                  }
  55.  
  56.           }  /* if out of this loop? probably passed by.  turn around */
  57.  
  58.          Dir += 170;
  59.          while (speed() > 49)
  60.                drive(0,0);
  61.  
  62.     } /* while */
  63.  
  64. }
  65.  
  66.