2020/pippo20a.r
01 | /* |
02 | Pippo 20 A ( tattica quasi copio/incolla da pippo20b ) |
03 |
04 | Tattica semplice: gira a quadrato intorno al campo di gioco, ma prima di percorrere |
05 | i tragitti orizzontali controlla che siano vuoti, il tutto per un certo |
06 | numero di volte, poi passa alla fase 2 |
07 |
08 | nella fase 2, sale e scende dall'arena di campo facendo movimenti obliqui |
09 | destra-sinistra |
10 |
11 | la funzione di fuoco pensa di averla fregata come gi� altre volte a Daniele |
12 | con qualche riduzione di codice e l'aggiunta di un controllo davanti e |
13 | dietro ( scan(dir,10) e scan(dir+180,10) ). |
14 |
15 |
16 | */ |
17 | int rng, |
18 | deg, |
19 | odeg, |
20 | dir, |
21 | tt; |
22 |
23 | main() |
24 | { |
25 | tt=48; |
26 | while ((--tt)>4) |
27 | { |
28 | if (!scan(0,10)){-tt; while (loc_x()<900) fuoco(drive(dir=0,100));} |
29 | fuoco(drive(dir=90,0)); |
30 | --tt; while (loc_y()<900) fuoco(drive(dir=90,100)); |
31 | fuoco(drive(dir=180,0)); |
32 | if (!scan(180,10)){-tt; while (loc_x()>100) fuoco(drive(dir=180,100));} |
33 | fuoco(drive(dir=270,0)); |
34 | --tt; while (loc_y()>100) fuoco(drive(dir=270,100)); |
35 | fuoco(drive(dir=0,0)); |
36 | } |
37 | while (1) |
38 | { |
39 | while (loc_y()<800) |
40 | { |
41 | while (loc_x()<900) fuoco(drive(dir=10,100)); |
42 | fuoco(drive(dir=170,0)); |
43 | while (loc_x()>100) fuoco(drive(dir=170,100)); |
44 | fuoco(drive(dir=10,0)); |
45 | } |
46 | while (loc_y()>200) |
47 | { |
48 | while (loc_x()<900) fuoco(drive(dir=350,100)); |
49 | fuoco(drive(dir=190,0)); |
50 | while (loc_x()>100) fuoco(drive(dir=190,100)); |
51 | fuoco(drive(dir=350,0)); |
52 | } |
53 | } |
54 | } |
55 |
56 | fuoco() |
57 | { |
58 | if (rng=scan(odeg=deg,10)) |
59 | { |
60 | if (scan(deg-8,5)) |
61 | { |
62 | if (scan(deg-=5,2)) ; |
63 | else deg-=4; |
64 | } |
65 | else |
66 | { |
67 | if (scan(deg+8,5)) |
68 | { |
69 | if (scan(deg+=5,2)) ; |
70 | else deg+=4; |
71 | } |
72 | else |
73 | { |
74 | if (scan(deg,1)) ; |
75 | else if (scan(deg-=3,2)) ; else deg+=6; |
76 | } |
77 | } |
78 | return (cannon(deg+(deg-odeg),2*scan(deg,10)-rng)); |
79 | } |
80 | else |
81 | { |
82 | if (rng=scan(deg+=20,10)); |
83 | else if (rng=scan(deg-=40,10)); |
84 | else if (rng=scan(deg+=60,10)); |
85 | else if (rng=scan(deg-=80,10)); |
86 | else if (rng=scan(dir,10)); |
87 | else if (rng=scan(dir+180,10)); |
88 | else while (!(rng=scan(deg,10)))deg+=19; |
89 | } |
90 |
91 | } |