crobs/twedlede.r

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