1996/carlo96.r

01/*
02 
03Torneo Crobots MCmicrocomputer 1996
04 
05ROBOT : CARLO96.R
06 
07Luigi Cimini
08 
09*/
10 
11int a, r, o;
12 
13main()
14{
15    drive(270,100); while(loc_y() > 40) fuoco();
16    drive(90,0);    while(speed() > 49) fuoco();
17    a = 180; o = 60;
18    while(1)
19   {
20    drive(0,100);   while(loc_x() < 900) fuoco();
21    drive(180,0);   while(speed() > 49)  fuoco();
22    drive(180,100); while(loc_x() > 99)  fuoco();
23    drive(0,0);     while(speed() > 49)  fuoco();
24   }
25}
26fuoco()
27{
28    if (r = scan(a,2))
29      {if (r == o) cannon(a, r); else {cannon(a,r+r-o); o=r;}}
30    else
31      {a -= 4; if (a < 4) a = 180;}
32}