1997/gundam.r

001/*----------------------------------------------------------------------------
002 
003  Nome         :  Gundam (29-09-1997)              \         /
004                                                    \ __^__ /
005  Autori       :  Luca Pranzo                       / \   / \
006                  Marco Pranzo                     �    V    �
007                                                  ������ ��߳��
008                                                  ���  ���  ���
009                                                   ��\ ��� /��
010                                                      \ _ /
011 
012 
013------------------------------------------------------------------------------
014 Costruito in analogia ad Arale, Gundam � stato creato per difendere la Terra
015 dagli altri  Robot  cattivi!!!  Si piazza nell'angolo pi� vicino e l� inizia
016 ad  oscillare.  Rimane in tale posizione  fino a 100000 cicli  dopo i  quali
017 utilizza il suo attacco segreto percorrendo una traiettoria a rombo sparando
018 a destra  e manca.  Le routine di sparo  e la struttura  del programma  sono
019 simili  ad  Arale  da  cui  differisce  per  l'angolo  di  oscillazione e la
020 strategia finale.
021----------------------------------------------------------------------------*/
022 
023int
024 posy,
025 timer,
026 d,ang;
027 
028main()
029{
030 timer=100;
031 posy=loc_y();
032 if (loc_x() > 500) if (posy > 500)
033  {
034   /* Posizionamento angolo Nord-Est */
035   drive(90,100); while (loc_y()<930) attack();
036   drive(90,0); quick_fire();
037   drive(0,100); while (loc_x()<930) attack();
038   drive(0,0); quick_fire();
039   /* Pendolo Nord-Est */
040   while (timer-=1) {
041                        drive(225,100);
042                        while((loc_y() > 850)&&(loc_x() > 850)) attack();
043                        drive(225,0);
044                        quick_fire();
045                        drive(45,100);
046                        while((loc_y() < 930)&&(loc_x() < 930)) attack();
047                        drive(45,0);
048                        quick_fire();
049                      }
050   /* Posizionamento finale */
051   drive(180,100);
052   while (loc_x() > 520) attack();
053   drive(180,0);
054   quick_fire();
055  }
056  else
057  {
058   /* Posizionamento angolo Sud-Est */
059   drive(0,100); while (loc_x()<930) attack();
060   drive(0,0); quick_fire();
061   drive(270,100); while (loc_y()>70) attack();
062   drive(0,0); quick_fire();
063   /* Pendolo Sud-Est */
064   while (timer-=1) {
065                     drive(135,100);
066                     while((loc_y() < 150)&&(loc_x() > 850)) attack();
067                     drive(135,0);
068                     quick_fire();
069                     drive(315,100);
070                     while((loc_y() > 70)&&(loc_x() < 930)) attack();
071                     drive(315,0);
072                     quick_fire();
073                    }
074   /* Posizionamento finale */
075   drive(90,100);
076   while (loc_y() < 480) attack();
077   drive(90,0);
078   quick_fire();
079   drive(135,100);
080   while (loc_y() < 950) attack();
081   drive(135,0);
082   quick_fire();
083  }
084  else if (posy > 500)
085  {
086   /* Posizionamento angolo Nord-Ovest */
087   drive(180,100); while (loc_x()>70) attack();
088   drive(180,0); quick_fire();
089   drive(90,100); while (loc_y()<930) attack();
090   drive(0,0); quick_fire();
091   /* Pendolo Nord-Ovest */
092   while (timer-=1) {
093                     drive(315,100);
094                     while((loc_y() > 850)&&(loc_x() < 150)) attack();
095                     drive(315,0);
096                     quick_fire();
097                     drive(135,100);
098                     while((loc_y() < 930)&&(loc_x() > 70)) attack();
099                     drive(135,0);
100                     quick_fire();
101                    }
102   /* Posizionamento finale */
103   drive(0,100);
104   while (loc_x() < 480) attack();
105   drive(0,0);
106   quick_fire();
107  }
108  else
109  {
110   /* Posizionamento angolo Sud-Ovest */
111   drive(270,100); while (loc_y()>70) attack();
112   drive(270,0); quick_fire();
113   drive(180,100); while (loc_x()>70) attack();
114   drive(0,0); quick_fire();
115   /* Pendolo Sud-Ovest */
116   while (timer-=1) {
117                     drive(45,100);
118                     while((loc_y() < 150)&&(loc_x() < 150)) attack();
119                     drive(45,0);
120                     quick_fire();
121                     drive(225,100);
122                     while((loc_y() >  70)&&(loc_x() > 70)) attack();
123                     drive(225,0);
124                     quick_fire();
125                    }
126   /* Posizionamento finale */
127   drive(90,100);
128   while (loc_y() < 480) attack();
129   drive(90,0);
130   quick_fire();
131   drive(45,100);
132   while (loc_y() < 950) attack();
133   drive(45,0);
134   quick_fire();
135  }
136/* Traiettoria a rombo (senso orario) */
137 while(1)  
138  {
139   drive(315,100); while(loc_x()<900) attack();  
140   drive(315,0);   quick_fire();
141   drive(225,100); while(loc_y()>100) attack();
142   drive(225,0);   quick_fire();
143   drive(135,100); while(loc_x()>100) attack();
144   drive(135,0);   quick_fire();
145   drive(45,100);  while(loc_y()<900) attack();
146   drive(45,0);    quick_fire();
147  }
148}
149 
150/* Routine di attacco standard */
151attack()
152
153 if ( (d=scan(ang,10)) && (d<750) )
154  {
155   if (d=scan(ang+353,3)) cannon(ang+=353,d);
156   else if (d=scan(ang,3)) cannon(ang,d);
157   else if (d=scan(ang+7,3)) cannon(ang+=7,d);
158  }
159 else
160  {
161   if ((d=scan(ang+21,10))&&(d<700)) {ang+=21;cannon(ang,d);}
162   else if ((d=scan(ang+42,10))&&(d<700)) ang+=42;
163        else ang+=63;
164  
165}                        
166 
167/* Routine di attacco veloce */
168quick_fire()
169{    
170 while (speed() > 49) if ((d=scan(ang,10))) cannon(ang,d);
171                      else ang+=21;
172}