1998/eva01.r
001 | /**************************************************************************/ |
002 | /*** EVA01.R "Macchina Umanoide Evangelion" ***/ |
003 | /*** "Unita' ZERO-UNO" ***/ |
004 | /*** ( Crobot per l'Ottavo Torneo di MCmicrocomputer ) ***/ |
005 | /*** ***/ |
006 | /*** Creatore : Yoshiyuki Sadamoto ***/ |
007 | /*** Autore : Stefano Francesi ***/ |
008 | /*** ***/ |
009 | /*** Creazione : 25.09.1998 ***/ |
010 | /*** Revisione : 30.09.1998 ***/ |
011 | /**************************************************************************/ |
012 |
013 | /**************************************************************************/ |
014 | /** STRATEGIA DI COMPORTAMENTO **/ |
015 | /** **/ |
016 | /** L'unita' ZERO-UNO e' l'evoluzione dell'esemplare di test ZERO-ZERO **/ |
017 | /** e presenta maggiori capacita' decisionali nelle situazioni critiche: **/ |
018 | /** dopo circa 130000 cicli, infatti, abbandona la propria condizione di **/ |
019 | /** pendolamento e viaggia con furia omicida lungo un ottagono alla **/ |
020 | /** ricerca dei nemici rimasti (probabilmente tutti ...) **/ |
021 | /** **/ |
022 | /** Dovendo scegliere, preferisco veder combattere EVA01.R **/ |
023 | /**************************************************************************/ |
024 |
025 | int batterie; /* Durata delle batterie */ |
026 | int angolomov; /* Direzione movimento attuale */ |
027 | int destx, desty; /* Punto di arrivo */ |
028 | int rangefuoco; /* Distanza 2. rilevamento */ |
029 | int scan1, scan2; /* Scanner primario e secondario */ |
030 | int oldscan, oldrange; /* Rilevamenti precedenti */ |
031 | int oldscan1, oldscan2; /* Posizione di partenza degli scanner */ |
032 | int range1, range2; /* Distanza 1. rilevamento su ciascuno scanner */ |
033 | int ang; /* Angolo di attacco */ |
034 | int check; /* Booleano per la scelta tra il miglior scanner */ |
035 |
036 | main() |
037 | { |
038 | batterie = 262; /*** Durata massima degli accumulatori ***/ |
039 |
040 | /*** EMERGENZA : Rilevati TRE angeli nemici ***/ |
041 | /*** Lancio dell'unita' Evangelion !!! ***/ |
042 |
043 | while (1) { |
044 | Entry_Plug(); |
045 | while (--batterie) shinji_ikari(); |
046 | Berserk(); |
047 | } /*** Salviamo l'umanita' ***/ |
048 |
049 | } |
050 |
051 | Progressive_Knife() /*** Arma principale di attacco ***/ |
052 | { |
053 | /** Riduzione angolo (tempo costante) **/ |
054 | if ((range1=scan(scan1, 10)) || (range2=scan(scan2,10))) |
055 | { |
056 | check=(((range1<range2) && (range1)) || (!range2)); |
057 | ang=scan1*check+scan2*(!check); |
058 | oldrange=range1*check+range2*(!check); |
059 | ang+=350*!(scan(ang+=5,5)); |
060 | ang+=354*!(scan(ang+=3,3)); |
061 | cannon(ang, 2*scan(ang,10)-oldrange); |
062 | scan1=ang; scan2=ang; |
063 | } |
064 | else |
065 | { /*** DOPPIO SCANNER sfasato (si cerca quello con range inferiore) ***/ |
066 | oldscan1=scan1; oldscan2=scan2; |
067 | scan1+=314*(!(!scan(scan1+314,10))); |
068 | scan2+=335*(!(!scan(scan2+335,10))); |
069 | scan1+=17*(!(!scan(scan1+17,10))); |
070 | scan2+=38*(!(!scan(scan2+38,10))); |
071 | scan1+=59*(scan1==oldscan1); /*** Nessun bersaglio in vista ***/ |
072 | scan2+=59*(scan2==oldscan2); /*** Continuare la ricerca ... ***/ |
073 | } |
074 | } |
075 |
076 | cerca360() |
077 | { |
078 | /*** Scanner per le fasi iniziali della partita ***/ |
079 | if (rangefuoco=scan(ang, 10)) |
080 | cannon(ang, rangefuoco); |
081 | else scan2 += 21; |
082 | } |
083 |
084 | occupato(x,y) |
085 | int x, y; |
086 | { |
087 | angolomov = direz(destx=x,desty=y); |
088 | if (scan(angolomov, 10)) return (1); else return (0); |
089 | } |
090 |
091 | Entry_Plug() |
092 | { |
093 | /*** Capitano Katsuragi, elabori la strategia migliore ***/ |
094 | /*** prima dell'inserimento nell'entry-plug !!! ***/ |
095 |
096 | /*** Preparazione dell'uscita ... ***/ |
097 | /*** Verifica percorso ... ALL GREEN ***/ |
098 | /*** Unita' ZERO-UNO ... LANCIARE !!! ***/ |
099 |
100 | angolomov = direz(500, 500); /* --- Centro --- */ |
101 | drive(angolomov, 100); |
102 |
103 | while ((dist(500,500) > 100) && (speed())) cerca360(); |
104 | |
105 | drive(angolomov, 0); /* --- Frenata --- */ |
106 | while (speed()>49) cerca360(); |
107 |
108 | if (occupato(950, 950)) |
109 | if (occupato(950, 50)) |
110 | if (occupato(50, 50)) |
111 | if (occupato(50, 950)); |
112 |
113 | /* --- Dirigersi verso l'angolo scelto --- */ |
114 |
115 | drive(angolomov, 100); |
116 | while ((dist(destx,desty) > 50) && (speed())) cerca360(); |
117 |
118 | drive(angolomov, 0); /* --- Frenata --- */ |
119 | |
120 | /*** Reset Nervo A10 ***/ |
121 | |
122 | Reset_Nervo_A10(); |
123 |
124 | /*** Emergenza : distacco dell'umbelical cable ***/ |
125 | /*** Durata delle batterie inferiore ai 200000 cicli di CPU ***/ |
126 | /*** Vai SHINJI non farti distruggere dagli angeli !!! ***/ |
127 | } |
128 |
129 | dist(x2,y2) |
130 | int x2, y2; |
131 | { |
132 | int x, y; |
133 |
134 | x = loc_x() - x2; y = loc_y() - y2; |
135 | return ( sqrt ((x*x) + (y*y))); |
136 | } |
137 |
138 | direz(xx,yy) |
139 | int xx, yy; |
140 | { |
141 | /*** Dottoressa Akagi, calcoli la direzione per condurre ***/ |
142 | /*** l'Evangelion al punto prestabilito !!! ***/ |
143 | |
144 | int d; |
145 | int x,y,r; |
146 | int curx, cury; |
147 |
148 | curx = loc_x(); cury = loc_y(); |
149 | x = curx - xx; y = cury - yy; |
150 | r = atan ((100000 * y) / x); |
151 |
152 | if (!x) |
153 | d = 90 + 180*(yy < cury); /* --- Nord / Sud --- */ |
154 | else |
155 | if (yy < cury) |
156 | d = r + 180 + 180*(xx > curx); /* --- Sud-Est / Sud-Ovest --- */ |
157 | else |
158 | d = r + 180*(xx < curx); /* --- Nord-Est / Nord-Ovest --- */ |
159 |
160 | return (d); |
161 | } |
162 |
163 | Reset_Nervo_A10() |
164 | { |
165 | /*** Tasso di sincronia insufficiente ... Reimpostare ... ***/ |
166 | |
167 | scan1=angolomov; scan2=angolomov; |
168 | } |
169 |
170 | shinji_ikari() |
171 | { |
172 | /*** Movimento a pendolo in un angolo lungo la diagonale ***/ |
173 | Reset_Nervo_A10(); |
174 | drive(angolomov+=180, 100); |
175 | Progressive_Knife(); |
176 | Progressive_Knife(); |
177 | Progressive_Knife(); |
178 | drive(angolomov, 0); |
179 | Progressive_Knife(); |
180 | } |
181 |
182 | blind_fire() |
183 | { |
184 | if ((rangefuoco=scan(ang,7)) && (rangefuoco<700)) { |
185 | cannon(ang,rangefuoco); |
186 | ang+=345; |
187 | } else ang+=15; |
188 | } |
189 |
190 | Berserk() |
191 | { |
192 | /*** Pericolo : perduta connessione nervo A10 ***/ |
193 | /*** Perdita del tasso di sincronia ... ***/ |
194 | /*** Condizione di berserk !!! ***/ |
195 | |
196 | angolomov = direz(500, 900); |
197 | drive(angolomov,100); |
198 | while (loc_y() < 900) blind_fire(); |
199 | drive(angolomov,0); |
200 | while (speed()>49) blind_fire(); |
201 | |
202 | /**** AT - FIELD ****/ |
203 | while (1) |
204 | { |
205 | drive(0, 100); while (loc_x()<600) blind_fire(); |
206 | drive(0, 0); while (speed()>49) blind_fire(); |
207 | drive(315,100); while (loc_x()<900) blind_fire(); |
208 | drive(315,0); while (speed()>49) blind_fire(); |
209 | drive(270,100); while (loc_y()>400) blind_fire(); |
210 | drive(270, 0); while (speed()>49) blind_fire(); |
211 | drive(225,100); while (loc_y()>100) blind_fire(); |
212 | drive(225,0); while (speed()>49) blind_fire(); |
213 | drive(180,100); while (loc_x()>400) blind_fire(); |
214 | drive(180, 0); while (speed()>49) blind_fire(); |
215 | drive(135,100); while (loc_x()>100) blind_fire(); |
216 | drive(135,0); while (speed()>49) blind_fire(); |
217 | drive(90, 100); while (loc_y()<600) blind_fire(); |
218 | drive(90, 0); while (speed()>49) blind_fire(); |
219 | drive(45,100); while (loc_y()<900) blind_fire(); |
220 | drive(45,0); while (speed()>49) blind_fire(); |
221 | } |
222 | } |