1997/fya.r

01/* NOME ROBOT:  fya
02   AUTORE:      Aneloni Giovanni
03*/       
04int count,scn,ang,oscn;
05main()
06{
07        count=0;
08        while (loc_y()>70)              /* si mette in posizione */
09        {
10                drive (270,100);
11                fuoco();
12                }
13        if (loc_x()<725)
14         while (loc_x()<725)
15         {
16                drive (0,100);
17                fuoco();
18                }
19        else
20         while (loc_x()>725)
21         {
22                drive (180,100);
23                fuoco();
24                }
25        while (++count<70)                      /*comincia il ciclo principale */
26        {                                      
27                while (loc_x()<930)
28                {
29                        drive (45,100);
30                        fuoco();
31                        }
32                while (loc_y()>70)
33                {
34                        drive (225,100);
35                        fuoco();
36                        }
37                }
38                finale();
39        }
40fuoco() /* rambo3 - routine gestione tiro in movimento */
41{
42  if(30<(scn=scan(ang,10))&&scn<700)         
43  {
44        if(scan(ang-6,3))
45         ang-=6;
46        else
47         if(scan(ang+6,3))
48          ang+=6;
49        cannon(ang,(scn<<1)-oscn);
50        }
51  else
52    if((scn=scan(ang-20,10))&&scn<700)               
53      cannon(ang-=20,scn);
54    else
55      if((scn=scan(ang+20,10))&&scn<700)
56        cannon(ang+=20, scn);
57      else
58        if((scn=scan(ang-40,10))&&scn<700)
59          cannon(ang-=40,scn);
60        else
61          if((scn=scan(ang+40,10))&&scn<700)
62            cannon(ang+=40,scn);
63          else
64            if((scn=scan(ang-60,10))&&scn<700)
65              cannon(ang-=60,scn);
66            else
67              if((scn=scan(ang+60,10))&&scn<700)
68                cannon(ang+=60, scn);
69              else
70                ang+=140;
71  oscn=scn;
72  }
73finale ()
74{
75        while (loc_x()>70)
76        {
77                drive (180,100);
78                fuoco();
79                }
80        while(1)
81        {
82                while (loc_x()<900)
83                {
84                        drive (45,100);
85                        fuoco();
86                        }
87                while (loc_x()>100)
88                {
89                        drive (225,100);
90                        fuoco();
91                        }
92                }
93        }