;Jx series robot ¥ Sunday 13th June 1999 ;Chris Green e-mail - c.green@cableinet.co.uk ; ;Here is a new robot for you - hope you like it :) ;It has simple navigation - don't go near walls (thats it!). ;But it does have really good target prediction and two ;types of scan. In all my tests it has done pretty well, dark3 ;did the best against it. I had another (the jx12) that loaded up ;all of the tables, but in the time it took to do it, half of ;its health would be lost - if it did wake up before it got killed ;it would select the proper speed table in real time and was ;then a very good shot (in my tests it was always the best ;marksman). The way this bot does it is to use the one table ;that is selected the first time the bot is ready to fire ;(locked on) - this has obvious flaws (the main one being that ;it locks on to a target before it has accelerated to full speed) ;it then uses this one table for the rest of the round. ; ;CURRENT FEATURES: ; ;navigation keep away from walls ;getting shot detection - tries to turn away ;you're too slow - target practice :) detection ;target prediction - for multiple direction and speed ;uses binary search (sort of) to calculate which speed table should ;be used ;now has two search methods - quick and tracking ;it also turns when it fires, sometimes circling its prey :) ;oh, and the tracking is sorta predictive too ; ;P.S. good luck with my spaghetti code :) ;It started out neat - honest. It needs re-writing...again #config scanner= 4 #config weapon= 3 #config armor= 2 #config engine= 2 #config heatsinks= 1 #config mines= 0 #config shield= 0 #msg jx v19-Marksman :) #def range #def arc #def armour #def jumper #def min_arc ;setup mov ax, 1 int 3 ;Keepshift ipo 6, armour ;set armour to init value mov arc, 64 ;arc start opo 17, arc opo 11, 100 ;100% throttle mov jumper, 4000 mov min_arc, 8 jmp 1 ;This could be improved by using tables that lie half way ;between 64cm/cycle boundaries eg - a table at 32, 96,160 ;and then shr enemy_speed, 6 then use appropriate table ;eg table at speed=32 is for speeds 0-63 so integer for all these ;speeds is zero. 64-127 is 1, 128-191 is 2. Then you just add a ;jump offset and do the jump. The only reason i haven't done it is ;because in this version of th JX, this is only run once, and I ;would have to redo all the tables. ick. ;the tables are at the end, have a look if you don't get what i'm ;going on about :) :4000 ;select speed table ;err [13] ;speed it will use cmp [13], 400 jge 6001 cmp [13], 350 jge 6006 cmp [13], 250 jge 6007 cmp [13], 205 jge 6009 jeq 3000 jne 3000 :6009 jeq 3001 jne 3001 :6007 cmp [13], 300 jge 6008 jeq 3002 jne 3002 :6008 ;set 325 jeq 3003 jne 3003 :6006 jeq 3004 jne 3004 :6001 cmp [13], 450 jge 6002 ;set to speed 425 jeq 3005 jne 3005 :6002 ;450+ cmp [13], 550 jge 6003 ;* cmp [13], 500 jge 6005 jeq 3006 jne 3006 :6005 jeq 3007 jne 3007 :6003 cmp [13], 600 jge 6004 ;set to speed 575 jeq 3008 jne 3008 :6004 ;set to speed 625 jeq 3009 jne 3009 :1 ;main cmp [0], 100 ;compare throttle to max jeq 2 ;this saves 3 cyc if at max opo 11, 100 ;set to max if less than max :2 ;naviagation int 2 ;locate, ex=x fx=y cmp ex, 100 ;too close to left? jgr 3 :4 cmp [1], 128 ;see if heading towards wall jls 3 opo 14, -30 ;if so turn jeq 4 ;turn until not facing wall jne 4 :3 cmp ex, 900 ;too close to right? jls 5 :6 cmp [1], 128 jgr 5 opo 14, -30 jeq 6 jne 6 :5 ;too close to top cmp fx, 100 jgr 9 :8 cmp [1], 64 jls 7 cmp [1], 192 jgr 7 jeq 9 jne 9 :7 opo 14, -30 jeq 8 jne 8 :9 ;too close to bottom cmp fx, 900 jls 11 :10 cmp [1], 64 jls 11 cmp [1], 192 jgr 11 opo 14, -30 jeq 10 jne 10 :11 ;collision detection ipo 6, ax ;get current armour cmp ax, armour ;compare to old armour jeq 12 ;if same skip to 12 mov armour, ax ;set armour to current value opo 14, -32 ;turn if hit :12 ;weapon control ipo 7, range ;scan cmp range, 1500 ;found any prey? jgr 13 ;no - damn :) cmp arc, 3 ;see if should shoot jle 999 ;call 999 that bot needs a medic! cmp arc, min_arc ;use fast search or track search? jgr 123456789 cmp [3], 1 ;scan search jgr 102 jeq 101 cmp [3], -1 jgr 100 jeq 99 jls 98 :98 ;accuracy is -2 neg arc opo 12, arc neg arc shr arc, 1 opo 17, arc jeq 12 jne 12 :99 ;accuracy is -1 shr arc, 1 ;1/2 arc opo 17, arc ;set neg arc ;turning left opo 12, arc ;turn neg arc ;reset arc to + jeq 12 jne 12 :100 ;accuracy is 0 shr arc, 1 ;1/2 arc opo 17, arc jeq 12 jne 12 :101 ;accuracy is 1 shr arc, 1 ;1/2 arc opo 17, arc opo 12, arc ;turn to right jeq 12 jne 12 :102 ;accuracy is 2 opo 12, arc shr arc, 1 opo 17, arc jeq 12 jne 12 :13 ;nothing found, enlarge or flip arc cmp arc, 64 ;is arc at max (or above)? jge 14 ;yes shl arc, 1 ;no - double arc opo 17, arc ;set new arc size jeq 1 ;return to start jne 1 :14 ;arc at max - flip it mov arc, 64 opo 12, 128 jeq 1 jne 1 :999 ;open fire! opo 12, [3] ipo 2, ax cmp ax, 200 ;temp check jgr 1 cmp [13], 160 ;slow? jgr 1000 :1001 ;overburn kill mov ax, 1 int 4 opo 15, [3] opo 15, [3] mov ax, 0 int 4 opo 14, -30 jne 1 jeq 1 :1000 ;******** ;TARGET PREDICTION ;******* once speed is known jeq jumper ;first time goes and selects speed table jne jumper :5000 mov bx, [6] cmp bx, 64 ;first quad jge 1800 shr bx, 2 add bx, 150 ;err bx opo 12, [bx] jeq 1234 jne 1234 :1800 cmp bx, 128 ;second quad jge 1900 mov ax, 128 sub ax, bx shr ax, 2 add ax, 150 ;err ax opo 12, [ax] jeq 1234 jne 1234 :1900 ;third quad cmp bx, 192 jge 2000 sub bx, 128 shr bx, 2 add bx, 150 ;err bx mov bx, [bx] neg bx opo 12, bx jeq 1234 jne 1234 :2000 mov ax, 256 sub ax, bx shr ax, 2 add ax, 150 ;err ax mov ax, [ax] neg ax opo 12, ax ;******** :1234 ;standard on the move shots opo 15, [3] opo 15, [3] opo 14, -30 jne 1 jeq 1 :123456789 ;FAST SCAN cmp [3], 1 jgr 111102 jeq 111101 cmp [3], -1 jgr 111100 jeq 11199 jls 11198 :11198 ;accuracy is -2 mov ax, arc shr arc, 3 sub ax, arc neg ax opo 12, ax cmp arc, min_arc jgr 1276 mov arc, min_arc opo 17, arc jeq 12 jne 12 :1276 opo 17, arc jeq 12 jne 12 :11199 ;accuracy is -1 shr arc, 1 ;1/2 arc neg arc opo 12, arc neg arc shr arc, 1 cmp arc, min_arc jgr 1277 mov arc, min_arc opo 17, arc jeq 12 jne 12 :1277 opo 17, arc jeq 12 jne 12 :111100 ;accuracy is 0 shr arc, 2 cmp arc, min_arc jgr 1278 mov arc, min_arc opo 17, arc jeq 12 jne 12 :1278 opo 17, arc jeq 12 jne 12 :111101 ;accuracy is 1 shr arc, 1 ;1/2 arc opo 12, arc ;turn to right shr arc, 1 cmp arc, min_arc jgr 1279 mov arc, min_arc opo 17, arc jeq 12 jne 12 :1279 opo 17, arc jeq 12 jne 12 :111102 ;accuracy is 2 mov ax, arc shr arc, 3 sub ax, arc opo 12, ax cmp arc, min_arc jgr 1280 mov arc, min_arc opo 17, arc jeq 12 jne 12 :1280 opo 17, arc jeq 12 jne 12 ;***********THE TABLES********************* :3000 ;tab 16 missile vel = 3840, enemy vel = 185 put 0, 150 put 0, 151 put 0, 152 put 1, 153 put 1, 154 put 1, 155 put 1, 156 put 1, 157 put 1, 158 put 2, 159 put 2, 160 put 2, 161 put 2, 162 put 2, 163 put 2, 164 put 2, 165 mov jumper, 5000 jeq 5000 jne 5000 :3001 ;tab 16 missile vel = 3840, enemy vel = 225 put 0, 150 put 0, 151 put 0, 152 put 1, 153 put 1, 154 put 1, 155 put 1, 156 put 2, 157 put 2, 158 put 2, 159 put 2, 160 put 2, 161 put 2, 162 put 2, 163 put 2, 164 put 2, 165 mov jumper, 5000 jeq 5000 jne 5000 :3002 ;tab 16 missile vel = 3840, enemy vel = 275 put 0, 150 put 0, 151 put 1, 152 put 1, 153 put 1, 154 put 1, 155 put 2, 156 put 2, 157 put 2, 158 put 2, 159 put 2, 160 put 3, 161 put 3, 162 put 3, 163 put 3, 164 put 3, 165 mov jumper, 5000 jeq 5000 jne 5000 :3003 ;tab 16 missile vel = 3840, enemy vel = 325 put 0, 150 put 0, 151 put 1, 152 put 1, 153 put 1, 154 put 2, 155 put 2, 156 put 2, 157 put 2, 158 put 3, 159 put 3, 160 put 3, 161 put 3, 162 put 3, 163 put 3, 164 put 3, 165 mov jumper, 5000 jeq 5000 jne 5000 :3004 ;tab 16 missile vel = 3840, enemy vel = 375 put 0, 150 put 0, 151 put 1, 152 put 1, 153 put 2, 154 put 2, 155 put 2, 156 put 3, 157 put 3, 158 put 3, 159 put 3, 160 put 4, 161 put 4, 162 put 4, 163 put 4, 164 put 4, 165 mov jumper, 5000 jeq 5000 jne 5000 :3005 ;tab 16 missile vel = 3840, enemy vel = 425 put 0, 150 put 0, 151 put 1, 152 put 1, 153 put 2, 154 put 2, 155 put 3, 156 put 3, 157 put 3, 158 put 3, 159 put 4, 160 put 4, 161 put 4, 162 put 4, 163 put 4, 164 put 4, 165 mov jumper, 5000 jeq 5000 jne 5000 :3006 ;tab 16 missile vel = 3840, enemy vel = 475 put 0, 150 put 0, 151 put 1, 152 put 1, 153 put 2, 154 put 2, 155 put 3, 156 put 3, 157 put 4, 158 put 4, 159 put 4, 160 put 4, 161 put 5, 162 put 5, 163 put 5, 164 put 5, 165 mov jumper, 5000 jeq 5000 jne 5000 :3007 ;tab 16 missile vel = 3840, enemy vel = 525 put 0, 150 put 1, 151 put 1, 152 put 2, 153 put 2, 154 put 3, 155 put 3, 156 put 4, 157 put 4, 158 put 4, 159 put 5, 160 put 5, 161 put 5, 162 put 5, 163 put 5, 164 put 6, 165 mov jumper, 5000 jeq 5000 jne 5000 :3008 ;tab 16 missile vel = 3840, enemy vel = 575 put 0, 150 put 1, 151 put 1, 152 put 2, 153 put 2, 154 put 3, 155 put 3, 156 put 4, 157 put 4, 158 put 5, 159 put 5, 160 put 5, 161 put 6, 162 put 6, 163 put 6, 164 put 6, 165 mov jumper, 5000 jeq 5000 jne 5000 :3009 ;tab 16 missile vel = 3840, enemy vel = 625 put 0, 150 put 1, 151 put 1, 152 put 2, 153 put 3, 154 put 3, 155 put 4, 156 put 4, 157 put 5, 158 put 5, 159 put 6, 160 put 6, 161 put 6, 162 put 6, 163 put 7, 164 put 7, 165 mov jumper, 5000 jeq 5000 jne 5000