1999/omega99.r
001 | /* |
002 |
003 | ====== Crobot OMEGA99 per scontri a 4 - by L.Cimini 26-11-1999 ====== |
004 |
005 |
006 | ROBOT : OMEGA99.R |
007 |
008 |
009 | Luigi Cimini |
010 |
011 |
012 | TECHNICAL CARD: |
013 |
014 | The crobot looks for an angle in which position and it there stay up to |
015 | when it has not suffered a superior damage to the 3 %, if the damage |
016 | overcomes this limit the crobot it moves in one of the adjacent angles, |
017 | if the angles have occupied oscillate for 100 cycles or up to when it |
018 | doesn't suffer a superior damage to the 8%. |
019 | The general strategy of the crobot consists of the check each 100 cycles |
020 | the number of the adversaries, if an only adversary stays and the crobot |
021 | has suffered inferior damages to the 88% it attaches, if the damages are |
022 | superior to the 87% it oscillate until at the end; old the 200000 cycles, |
023 | if the surviving adversaries are two and the damages are small of the 60% |
024 | the crobot oscillates for 100 cycles, if the damages are small of the 30% |
025 | it oscillate for 100 cycles and it then effect the final attack also. |
026 |
027 | The routine of fire, already note, it has stayed modified for increase his |
028 | efficiency, the routine is able to behavior 4 types of draught, from firm, |
029 | in movement and for near target or far, the scanning could be rapid or |
030 | normal, the type of draught has selected in base to the distance, but also |
031 | using like selector the function speed() and a flag for normal express. |
032 |
033 | CHOICE: |
034 |
035 | If it is necessary limit the fights to an only crobot you do |
036 | you the choice. |
037 |
038 |
039 | SCHEDA TECNICA: |
040 |
041 | Il crobot cerca un angolo in cui posizionarsi e vi resta fino a quando |
042 | non ha subito un danno superiore al 3 %, se il danno supera questo |
043 | limite il crobot si trasferisce in uno degli angoli adiacenti, se gli |
044 | angoli sono occupati oscilla per 100 cicli o fino a quando non subisce |
045 | un danno superiore all'8 %. |
046 | La strategia generale del crobot consiste nel controllare ogni 100 cicli |
047 | il numero degli avversari, se resta un solo avversario e il crobot ha |
048 | subito danni inferiori all'88 % attacca, se i danni sono superiori |
049 | all'87 % oscilla fino alla fine; superati i 200000 cicli, se gli |
050 | avversari sopravvissuti sono due e i danni sono minori del 60 % il |
051 | crobot oscilla per 100 cicli, se i danni sono minori del 30 % oscilla |
052 | per 100 cicli e poi effettua anche l'attacco finale. |
053 |
054 | La routine di fuoco, gia` nota, � stata modificata per aumentare la sua |
055 | efficienza, la routine � in grado di fare 4 tipi di tiro, da fermo, |
056 | in movimento e per bersaglio vicino o lontano, la scansione pu� essere |
057 | rapida o normale, il tipo di tiro � selezionato in base alla distanza, |
058 | ma anche usando come selettore la funzione speed() ed un flag per rapido |
059 | normale. |
060 |
061 | SCELTA: |
062 |
063 | Se � necessario limitare i combattimenti ad un solo crobot fate voi |
064 | la scelta. |
065 |
066 |
067 | */ |
068 |
069 | int a,d,danno,n,r,o,oa,t,tt,f; |
070 |
071 | main() |
072 | { |
073 | tt=3000; /*100 x 30*/ |
074 | |
075 | if (loc_x()<500) sx(0); else dx(999); |
076 | if (loc_y()>500) |
077 | { |
078 | if (libero( 90)) up(999); |
079 | else if (libero(270)) dn(0); |
080 | else up(999); |
081 | } |
082 | else |
083 | { |
084 | if (libero(270)) dn(0); |
085 | else if (libero( 90)) up(999); |
086 | else dn(0); |
087 | } |
088 | danno=damage(); |
089 | |
090 | while (1) |
091 | { |
092 | t=100; |
093 | while (--t) |
094 | { |
095 | fuoco(0); if (damage()>(danno+3)) { scappa(); danno=damage();} |
096 | } |
097 | tt-=100; |
098 | |
099 | n=0; a=1; while (a!=721) { if (scan(a,10)) ++n; a+=20;} |
100 | |
101 | if (n<3) |
102 | { |
103 | if (damage()<88) finale(); else oscilla(); |
104 | } |
105 | else if (tt<1) |
106 | { |
107 | if ((n<5) && (damage()<60)) |
108 | { |
109 | oscilla(); if (damage()<30) finale(); |
110 | } |
111 | } |
112 | } |
113 | } |
114 |
115 | libero(a) |
116 | { |
117 | return (((scan(a,10))+(scan(a+20,10)))<150); |
118 | } |
119 |
120 | sito() |
121 | { |
122 | return (loc_x()>500)+2*(loc_y()>500); /* 0=SO 1=SE 2=NO 3=NE */ |
123 | } |
124 |
125 | sx(x) {d=180; while (loc_x()>x) {drive(d,100); fuoco(1);} drive(d,0); } |
126 | dx(x) {d=0; while (loc_x()<x) {drive(d,100); fuoco(1);} drive(d,0); } |
127 | dn(y) {d=270; while (loc_y()>y) {drive(d,100); fuoco(1);} drive(d,0); } |
128 | up(y) {d=90; while (loc_y()<y) {drive(d,100); fuoco(1);} drive(d,0); } |
129 |
130 | scappa() |
131 | { |
132 | if (loc_y()< 500) { if (libero( 90)) { up(953); return ; } } |
133 | else { if (libero(270)) { dn(66 ); return ; } } |
134 | if (loc_x()< 500) { if (libero( 1)) { dx(933); return ; } } |
135 | else { if (libero(180)) { sx(66 ); return ; } } |
136 | oscilla(); |
137 | } |
138 |
139 | oscilla() |
140 | { |
141 | danno=damage(); |
142 | t=100; |
143 | while ( (--t) && (damage()<(danno+9)) ) |
144 | { |
145 | if (loc_y()< 500) { up(266); dn(100); } else { dn(733); up(900); } |
146 | } |
147 | } |
148 |
149 | finale() |
150 | { |
151 | if ((sito()==1) || (sito()==2)) d=315; else d=45; |
152 | while (1) |
153 | { |
154 | while (loc_x()<866) { drive (d,100); fuoco(0); } d+=180; |
155 | while (loc_x()>133) { drive (d,100); fuoco(0); } d+=180; |
156 | } |
157 | } |
158 |
159 | fuoco(f) |
160 | { |
161 | if ( (r=scan(a,10)) && (r<767)) |
162 | { |
163 | if (!scan(a+=355,5)) a+=10; |
164 | if (r<313) |
165 | { |
166 | if (!scan(a+=357,3)) a+=6; |
167 | cannon(a,(scan(a,10)<<1)-r); |
168 | return ; |
169 | } |
170 | if (scan(a+355,1)) a+=355; |
171 | if (scan(a+5, 1)) a+=5; |
172 | if (scan(a+357,1)) a+=357; |
173 | if (scan(a+3, 1)) a+=3; |
174 | if (scan(a+359,1)) a+=359; |
175 | if (scan(a+1, 1)) a+=1; |
176 | |
177 | if (o=scan(oa=a,5)) |
178 | { |
179 | if (scan(a+355,1)) a+=355; |
180 | if (scan(a+5, 1)) a+=5; |
181 | if (scan(a+357,1)) a+=357; |
182 | if (scan(a+3, 1)) a+=3; |
183 | if (scan(a+359,1)) a+=359; |
184 | if (scan(a+1, 1)) a+=1; |
185 | |
186 | if (r=scan(a,10)) |
187 | { |
188 | if (speed()) |
189 | { |
190 | cannon(a+(a-oa)*((1200+r)>>9)-( sin (a-d)>>14), r*160/(160+o-r-( cos (a-d)>>12))); |
191 | } |
192 | else |
193 | { |
194 | cannon(a+(a-oa)*((1200+r)>>9), r*160/(160+o-r)); |
195 | } |
196 | } |
197 | } |
198 | } |
199 | else if (scan(a+339,10)) a+=339; |
200 | else if (scan(a+21, 10)) a+=21; |
201 | else if (f) {a+=42; return ;} |
202 | else if (scan(a+318,10)) a+=318; |
203 | else if (scan(a+42, 10)) a+=42; |
204 | else a+=105; |
205 | } |