crobs/twedledm.r

01/* Tweedlee Dum */
02/* By Eric Maddox */
03/* This goes to the east wall then moves up and down while it */
04/* scans and fires west. */
05main (){
06 while (loc_x() < 940 ) drive (0,100);
07 while (loc_x() < 950 ) drive (0,50);  /* go to east wall */
08 while (loc_x() < 985 ) drive (0,25);
09 while (loc_x() < 994  ) drive (0,10);
10 drive (180,0); /* stop */
11     while (1) /* infinite loop */
12           {
13           while (loc_y() < 900)
14                 {
15                  drive (90,100); /* go up */
16                  fire();   /* scan and fire west */
17                 }
18           while (loc_y() > 100)
19                 {
20                  drive (270,100);  /* go down */
21                  fire();  /* scan and fire west */
22                 }
23           }
24} /*main*/
25fire ()
26{int range;
27range=scan(175,5);
28while ((range > 0) && (range < 700) && (loc_y() < 950))
29      {cannon(175,range);range=scan(175,5);}
30range=scan(180,5);
31while ((range > 0) && (range < 700)) {cannon(180,range);range=scan(180,5);}
32range=scan(185,5);
33while ((range > 0) && (range < 700) && (loc_y() > 50))
34      {cannon(185,range);range=scan(185,5);}
35}
36