1997/ciccio.r
001 | /* |
002 | Ciccio.r |
003 | ...robot palermitano! |
004 | Versione del: 29/9/1997 |
005 | Partecipante al VII� torneo di MCmicrocomputer |
006 | un Crobot di Francesco Passantino |
007 |
008 | Cicciuzzo si muove sul lato ovest del perimetro di gioco, restando |
009 | negli angoli finche' non e' colpito. |
010 | Adotta due differenti routine di tiro: |
011 | - la prima per il tiro in movimento, che usa uno scan da 45 gradi |
012 | - la seconda per il tiro da fermo, tratta dal robot godel.r di S. Biraghi |
013 |
014 | il robot perde spesso, pareggia molto e non vince mai! |
015 | */ |
016 |
017 |
018 | int dam,sdam,safe,K,k,DeltaR,i,orange,range,dir,DeltaD; |
019 |
020 | main() |
021 | { |
022 |
023 | sdam=1; |
024 | safe=20; |
025 |
026 | while (loc_x()<1000-safe) |
027 | { |
028 | drive(0,100); |
029 | fuoco2(); |
030 | } |
031 |
032 | while (1) |
033 | { |
034 | while (loc_y()<1000-safe) |
035 | { |
036 | drive(90,100); |
037 | fuoco2(); |
038 | } |
039 | stop(); |
040 |
041 | while (loc_y()>safe) |
042 | { |
043 | drive(270,100); |
044 | fuoco2(); |
045 | } |
046 | stop(); |
047 | } |
048 | } |
049 |
050 | fuoco2() |
051 | { |
052 | if (range=scan(90,10)) |
053 | cannon(90,range); |
054 | if (range=scan(270,10)) |
055 | cannon(270,range); |
056 | if (range=scan(180,10)) |
057 | cannon(180,range); |
058 | if (range=scan(135,10)) |
059 | cannon(135,range); |
060 | if (range=scan(225,10)) |
061 | cannon(225,range); |
062 | } |
063 |
064 |
065 |
066 | stop() |
067 | { |
068 | drive (0,0); |
069 | dam = damage()+sdam; |
070 | while (damage()< dam) fermo(); |
071 | } |
072 |
073 |
074 | fermo () |
075 | { |
076 | if (orange=scan(dir,10)) |
077 | { |
078 | if (orange>700) { dir+=19;--k;K=1; return ;} |
079 | if (scan(dir,2)) |
080 | { |
081 | if (scan(dir+=1,1)); |
082 | else dir+=359; |
083 | } |
084 | else if (scan(dir+6,4)) dir+=6; else dir+=354; |
085 | if (K) {i=5; while (--i);} |
086 | DeltaR=4; |
087 |
088 | if (range=scan(dir,1)) DeltaD=0; |
089 |
090 | else if (range=scan(dir+=4,2)) |
091 | DeltaD=7; |
092 | else if (range=scan(dir+=352,2)) |
093 | DeltaD=353; |
094 | else if (range=scan(dir+=12,2)) { |
095 | DeltaD=8; |
096 | DeltaR=3; |
097 | } |
098 | else if (range=scan(dir+=344,2)) { |
099 | DeltaD=352; |
100 | DeltaR=3; |
101 | } |
102 | else if (range=scan(dir+=20,2)) { |
103 | DeltaD=10; |
104 | DeltaR=3; |
105 | } |
106 | else if (range=scan(dir+=336,2)) { |
107 | DeltaD=350; |
108 | DeltaR=3; |
109 | } |
110 | else {dir+=330;K=1; return ;} |
111 |
112 | K=fuoco(); |
113 |
114 | k=30; |
115 |
116 | } |
117 | else |
118 | { |
119 | while (!(scan(dir+=19,10))); |
120 | dir%=360; |
121 | } |
122 | } |
123 |
124 | fuoco() |
125 | { |
126 | return !(cannon(dir+DeltaD,(815+(range-orange)*DeltaR)*range/800)); |
127 | } |