2015/wall-e_v.r
001 | /* |
002 | ..................................................................,$77777$:..... |
003 | .................................................................7777777777$.... |
004 | .,MM...MMM..MMM....MMMMMMMMMM....MMM......... MMM...............7,.........~7... |
005 | .,MM...MMM..MMM....MMD.....MMM ..MMM..........MMM..............$7...7777777$7$.. |
006 | .,MM...MMM..MMM. MMN?????MMM...MMM..........MMM.........MMM..77. ........777.. |
007 | .,MM...MMM..MMM. ..MMMMMMMMMMM .MMM..........MMM..........8...77...7777777$77.. |
008 | .,MMMMMMMMMMMMM....MMD.. MMM MMMMMMMMMMM .MMMMMMMMMM$......:7.. ......~7~.. |
009 | ................................... ... ... ........... ...777777777777~... |
010 | ................. ...........................$7777777$..... |
011 | .............. ................. ... .............. |
012 | ........ ................................ |
013 | ....... ..... |
014 | ...... .. ..... ..... |
015 | ...... ........:=,:~+...... |
016 | .. ......=+++I?O$8D8DZ$ON~..... |
017 | ... ....77?I77888OO?NNNI8NDMZN7.... |
018 | .. ..IIIZIDZZI8ODNMMN8N8ONMMM7OM.... |
019 | ...DDD8O887=ZMMDNNNMONMMDDNM=?N.... |
020 | ....8DND8DD$?+DNMNDOONN8NNN87=?N.... |
021 | ...$MDDDD7==+7DOZDNNNNO7I+==+N.... |
022 | ...:?DDDD7IZ+I8Z..+DDDDZI7ID... |
023 | .......I8DO8Z8O......... ... . |
024 | ...........?8D8............ |
025 | ............ZDOOO~........... .. |
026 | ..... .............DDMOD............ .... |
027 | .. ..... ..+=~,..... ...7ZZD~.............. ....... |
028 | .... ..~~:~~,?7MND+?Z$O8ZDIZZZZ~==IO,........... ......... |
029 | .... .:::::~~=I$OON$~::~=7DD8OZOOO88OOOO77$$Z$77I7........... |
030 | .... .~::~:::~~?=~=~:::~::::I7Z$ODZ7+I+7+??+++=$=:: .......... |
031 | .... .$O7??~~+=,?::~::::::,:?I$:I+DZ=~I+Z=$O8??$7O8~............ |
032 | .... Z7777777$Z?+=::~:=,,,,,77,~+DDZ=788OD8DZ88O7I8=+8I?=....... |
033 | .... .ZZ$$O$7777II$7I$Z,,..,,::::$8O=IN8DDDNN88D8887?8?+8OI?++:.. |
034 | .... .OZZ$Z$$$$777II77I::,,,,:,,:,?88=Z~?$I8OZ?II$7O+8Z+87ODD8??.. |
035 | .... .,$ZZ$ZZ$$$$$7I$$7I,,,,,,,..,,~8O??7$?+$77O$8ZOONZ..=OO8DD8+.. |
036 | .......$ZZZZZ$$Z$$$$$$$$~,:,,:,,,,,,:ZZI?I+I+7$8ZO$I7DNI....NDONN8O. |
037 | ......7OZZOZOO$$$$$$$$$$~,,:,,.,,,,:$Z87++II7$77IZI778N?....DDD~8O:. |
038 | ......NZOOZZZZZZZZZ$$$7~,:,:,::,,,,,O878N$7?++???7???ON$...I888IOI . |
039 | ......OOOOODZZZZZZ$Z$$?I~,,,,,,::,,ZZD7$7===+++++I+==ZD7.......:O... |
040 | ... ..D88OOOOO88ZZZ$II?I+=:==,:::ZID$7II=7788O$D8$OZO8$............ |
041 | .... ....:DD8OOZOZZ8II?IIZI?=~~~+8DOO7=I+7O8MO778DDD$OZO........... |
042 | .... .. .=ND88OO77$IIII?III??88NDZI~I+ZO8DODZO7DND8DO$.......... |
043 | .... 8DN8DD8DD88$$Z$IIII?OO88DD$D8DD8ONOMD88ZOOONN$O+........ |
044 | .DDDDON8DOOONN88O$$$7MDZINNOO8D88N8O8DONN88ZDMDMND8....... |
045 | .DD8DDDD8ON8DD8MDM8DDNNNNN88DNN88N88ZOZDDNON8N$?7NNO...... |
046 | ..D8ND8D8ODNDDD8NDND8DNNNN8NMMNNO$NNNOD8OONMMMNOZ88DDO. |
047 | ..MDDODDDMMDNMNDNNNDMNMNNN.,,,NN88O888D8$D..O8D8OZ7ONN+ |
048 | .DD8NNNNMNNNNNNMMNMNMND$II?Z8O8ND8NMDD?8OD8DNNDM?ONND. |
049 | ~==?NNNDNNNNNNNMNNND8OOZ$$77O$Z8N888D88$ZND8DNDZ$O$88N~. |
050 | ..=+?I77$ODDNND88OOOOOZZZZ$$$8DNDDODZD87$$ODZDMN87ZNDDD: |
051 | ,===+??III77$$$$$ZZZZZZ$$$$$$D88O888DD8O$Z88OOZ8MD8NN8DN.. |
052 | .~==+??III777777$$$$$$$$$$$$$$DNNDDN8OZZ888DOOON8MMDDDN. |
053 | .... . ,~+??IIIIII777777777777777IDNDNDDDDDDDDN8O888MDND8N~..... |
054 | .... .....,,,,~????IIIIIIIIII=,,,,.~IINDDDNNDONN8DOMN888DNI,,,,.... |
055 | .... ........,,,,,:+???+~,,,,,,,,,,+??IIOMNNDDNON8N888N=:,,,,,,,.... |
056 | .... ..... ,,,,,,,,,,,,,,,,,,,,,,,,~???III7$8NNDNDNI,,,,,.,.,,,.. |
057 | .... .......,,,,,,,,,,.,,..,,,,,,,,,,,,,:=????III,,..,,,,,,.,,,,. |
058 | .,,,,,,,,,,,,,,..,.........,,.,,,,,,,,,,,,,,,,,,,,,,,,.,,,,.. |
059 | .,,,,,,,,,,,,,,.............,,,,,,,,,,,,,,,,,,,,,,,..,,,,,.. |
060 | .,,,,,,,,,,,,,,,.,..........,,,,....,,,,,,,,.,,,.,,,..,,,. |
061 | . ,,,,,,,,,,,,,,,,,,..........,,,,.....,,,,,,,,,,,,,,,,,,. .~ ++=.~=. |
062 | .,,,,,,,,,,,,,,,,............,,,.....,,,,,,,,,,,,,,... . ... .. |
063 | ,,,,,,,,,,,,,,,,............,,,,,,..,,,,,,,,,,,,,.... |
064 |
065 | Crobot : Wall-E |
066 | Type : Micro |
067 | Version : 5.02 |
068 | Author : Maurizio Camangi |
069 | Begin : 29-03-2015 |
070 | Revision : 16-04-2015 |
071 |
072 | Wall-E V inherits (almost) everything from Wall-E IV because its author is |
073 | lazy and does not have much time. |
074 |
075 | Whilst no-one usually gives a darn about reading these comments I can write |
076 | anything I want regardless of the fact this is not my mother-tongue and my |
077 | English is awful. |
078 |
079 | Wall-E V loses the correction flag within the fire function. |
080 |
081 | This is probably the last Wall-E descendant. Ideas have waned and even I |
082 | manage to reach the version 8 (VIII) its name would be too long... |
083 | OK, frankly speaking, however bad things go, there will be other two of |
084 | them... |
085 |
086 | 1. A robot may not injure a human being or, through inaction, allow a human |
087 | being to come to harm. |
088 | 2. A robot must obey orders given to it by human beings, except where such |
089 | orders would conflict with the First Law. |
090 | 3. A robot must protect its own existence as long as such protection does not |
091 | conflict with the First or Second Law. |
092 | */ |
093 | int ang, /* Current scan degree */ |
094 | oang, /* Previous scan degree */ |
095 | range, |
096 | dir, /* Heading */ |
097 | posx, |
098 | posy, /* Bit variables holding the current position */ |
099 | flag,b, /* Status flags */ |
100 | timer, /* Timer and enemies counter */ |
101 | deg, /* Starting degree to scan and count enemies */ |
102 | i,a; /* Temporary variables */ |
103 |
104 | fire(dir,v) |
105 | { |
106 | drive(dir,v); |
107 | if (range=scan(oang=ang,10)) |
108 | { |
109 | if (scan(ang-8,5)) |
110 | { |
111 | if (scan(ang-=5,2)) ; |
112 | else ang-=4; |
113 | } |
114 | else |
115 | { |
116 | if (scan(ang+8,5)) |
117 | { |
118 | if (scan(ang+=5,2)) ; |
119 | else ang+=4; |
120 | } |
121 | else |
122 | { |
123 | if (scan(ang,1)) ; |
124 | else if (scan(ang-=3,2)) ; else ang+=6; |
125 | } |
126 | } |
127 | return (cannon((ang<<1)-oang,(scan(ang,10)<<1)-range)); |
128 | } |
129 | else |
130 | { |
131 | if (range=scan(ang+=20,10)) cannon(ang,range); |
132 | else if (range=scan(ang-=40,10)) cannon(ang,range); |
133 | else ang+=80; |
134 | } |
135 | } |
136 |
137 | runX() |
138 | { |
139 | dir=180*!posx; |
140 | if (posx) while (loc_x()<880) fire(dir,100); |
141 | else while (loc_x()>120) fire(dir,100); |
142 | fire(dir,0); |
143 | } |
144 |
145 | runY() |
146 | { |
147 | dir=270-180*posy; |
148 | if (posy) while (loc_y()<880) fire(dir,100); |
149 | else while (loc_y()>120) fire(dir,100); |
150 | fire(dir,0); |
151 | } |
152 |
153 | corner() |
154 | { |
155 | if (flag^posx^posy) runY(runX()); else runX(runY()); |
156 | } |
157 |
158 | int look() |
159 | { |
160 | if (scan(a=deg+90*flag,10)) ang=a; |
161 | return 6; |
162 | } |
163 |
164 | main() |
165 | { |
166 | corner(posy=loc_y(posx=loc_x()>499)>499); |
167 | deg=90*((posy<<1)|(posx^posy)); |
168 | while (1) |
169 | { |
170 | while ((timer<2) && (i < 140)) { timer+=(scan(deg+i,10)>0); i+=20; } |
171 | if (timer<2) |
172 | { |
173 | while (1) |
174 | { |
175 | if (((posx=loc_x())%880)<120) dir=180*(posx>500); |
176 | else if (((posy=loc_y())%880)<120) dir=90+180*(posy>500); |
177 | else if (range>610) dir=ang+15+330*(b^=1); |
178 | else if (range<180) dir=ang+180; |
179 | else dir=ang+180*(b^=1); |
180 |
181 | fire(dir,100); |
182 | fire(dir,100); |
183 | fire(dir,100); |
184 | } |
185 | } |
186 | else |
187 | { |
188 | timer=look(dir=(deg+(30<<flag))); |
189 | } |
190 | while (--timer) fire(dir,100); |
191 | corner(i=0); flag^=1; |
192 | } |
193 | } |