;Robot EHEU, programmed by Jude Hungerford. Work started on 1/11/2000. ;Last modified on 3/12/2000. ;Version 0.43 ;This robot owes ideas, but no direct code, to Warblade, Zitgun, JX19, and ;probably a whole host of other 'bots. ;Modlist: ;Previous bits of modlist in their own file. Email me at ;lichen_dragon@my-deja.com if you want to see it. ;0.35 - 0.36: ;Hm. Well. It's going to be a lot of work getting all the new values in ;place. I'll start out with the medium-slow and medium-fast values, because ;they're the ones most likely to be used. Still, I just hope I'm heading in ;the right direction because if I'm not, it'll be a lot of work for nothing. ;I've tidied up some of the new code a little, and added a diagnostic ;feature for the firing offsets. ;And made a few adjustments to the firing offsets. Time I moved onto a new ;version, I think. ;0.36 - 0.37: ;Adjusting firing offsets. ;Seems to be improving. ;0.37 - 0.38: ;More firing offset tweaks, this time using a formula. :) ;Right the actual calculated values are in. They probably ;won't work, of course. ;As predicted, its accuracy has gone down. ;0.38 - 0.39: ;Still modifying the offsets, of course. This time I'm following the general ;trend of the calculated values, but changing them here and there to conform ;to my idea of what works. :) ;0.39 - 0.40: ;Trying to emulate the offsets from version 0.34 under the new system now. ;A very small amount of code tidying, and more firing offset modifications. ;0.40 - 0.41: ;I'm trying a new robot configuration and have increased the heat threshhold, ;which seems to have been good. I've also made minor changes to the firing ;offsets. ;0.41 - 0.42: ;I've discovered a mistake in the new offset code and fixed it. ;449:478 was the result from the latest 0.42 vs. 0.34 battle. There really ;isn't that much difference between them. I'll still check new versions ;against 0.34, but I won't really worry about it too much. ;0.42 - 0.43: ;Trying a new vehichle configuration with new code to take advantage of more ;speed. ;That failed, trying the same thing but with a different configuration. ;That seems to have worked quite well. !init #config scanner= 3 #config weapon= 3 #config armor= 4 #config engine= 0 #config heatsinks= 2 out 11, 100 ;full throttle. out 22, 7 ;lay mine, trigger 7. out 17, 64 ;128 degree scan arc. mov DX, 64 mov AX, 1 int 3 ;keepshift on. ;Firing offsets: put 0, 385 ;Fast target. put 0, 386 put 2, 387 put 2, 388 put 4, 389 put 4, 390 put 5, 391 put 5, 392 put 6, 393 put 6, 394 put 6, 395 put 6, 396 put 6, 397 put 7, 398 put 7, 399 put 7, 400 put 0, 401 ;Upper-medium target. put 0, 402 put 2, 403 put 2, 404 put 3, 405 put 3, 406 put 3, 407 put 4, 408 put 4, 409 put 4, 410 put 4, 411 put 3, 412 put 3, 413 put 2, 414 put 1, 415 put 1, 416 put 0, 417 ;Lower-medium target. put 1, 418 put 1, 419 put 2, 420 put 2, 421 put 2, 422 put 2, 423 put 2, 424 put 2, 425 put 3, 426 put 4, 427 put 3, 428 put 2, 429 put 3, 430 put 2, 431 put 1, 432 put 0, 433 ;Slow target. put 1, 434 put 1, 435 put 1, 436 put 1, 437 put 1, 438 put 1, 439 put 1, 440 put 1, 441 put 2, 442 put 2, 443 put 2, 444 put 2, 445 put 2, 446 put 2, 447 put 2, 448 !path in 10, ax ;get random number. add ax, 32768 ;make positive. shr ax, 9 ;reduce to 0-64. add ax, 36 ;36-100. out 11, ax ;set throttle to random value. cmp @9, 200 ;Have we travelled 200 metres? jgr !steer ;if yes, steer. int 12 ;collisions? cmp FX, 0 jgr !crash ;if yes, respond to crash. jmp !scan !crash out 11, -75 ;reverse int 13 ;reset collision count. jmp !checkpos ;determine where to go. !steer int 19 ;clear meters count. jmp !checkpos ;steer. !scan in 7, BX ;scan cmp BX, 1500 ;anyone in sight? jge !nonefound ;adjust scan arc to suit. jls !arcmodf ;modify arc & fire. jmp !path ;path - will never be called. !nonefound cmp DX, 64 ;Are we at maximum scan width already? je !flip ;if yes, flip turret. shl DX, 1 ;else, double DX and out 17, DX ;set new scans to DX width. jmp !path ;path !flip out 12, 125 ;turn turret 125 degrees. jmp !path ;path !arcmodf cmp DX, 2 ;is scan angle 1 degree? je !fire ;if yes, fire. Else: shr DX, 1 ;halve DX out 17, DX ;set scans to DX. cmp @3, 0 ;is enemy in centre? jgr !accright ;if right, respond jls !accleft ;if left, respond. jmp !path ;else, path. !accright out 12, DX ;turn radar right by scanarc. cmp @3, 2 ;is it out by +2? jls !path ;if less, path. mov BX, DX ;Else: BX=DX shr BX, 2 ;BX=25%DX add BX, DX ;BX=125% DX out 12, BX ;turn radar right by 125% scanarc. jmp !path ;path. !accleft mov BX, DX ;set BX=scanarc neg BX ;and negate BX out 12, BX ;turn radar left by scanarc. cmp @3, -2 ;is it out by -2? jgr !path ;if more, path. neg BX ;Else: BX=DX shr BX, 2 ;BX=DX/4 add BX, DX ;BX=5DX/4 neg BX ;BX=-5dx/4 out 12, BX ;turn radar left by 125% scanarc. jmp !path ;path. !fire out 12, @3 ;correct turret. in 2, BX ;check heat. cmp BX, 200 ;too hot? jgr !lock ;if yes, lock. Else: cmp @7, 0 ;Is target stationary? je !statfire ;if yes, fire at stationary target. Else: jgr !pmovfire ;if moving forward, fire forwards of target. jls !nmovfire ;if moving backward, fire backward of target. !statfire mov AX, 1 ; int 4 ;Overburn= on. out 15, 0 ;fire out 15, 0 ;fire out 15, 0 ;fire out 15, 0 ;fire mov AX, 0 ; int 4 ;Overburn = off. jmp !lock ;lock. !pmovfire cmp @13, 450 ;target above 400 cm/cycle (normal max.400) ? jgr !pmovfireff ;yes, fire at v. fast target. cmp @13, 250 ;250750? jgr !rwall ;if yes, respond to right wall. Else: cmp fx, 250 ;fx<250? jls !uwall ;if yes, respond to downward wall. Else: cmp fx, 750 ;fx>750? jgr !dwall ;if yes, respond to upward wall. Else: jmp !scan ;return. !lwall cmp @1, 128 ;error checking jls !scan ;robot was moving away anyway. cmp @1, 192 ;Is tank heading up or down oblique to wall? jgr !lwallr ;If up, turn right. Else: jle !lwalll ;down, turn left. !lwallr mov EX, 256 ;desired heading (-16). sub EX, @1 ;difference from current heading. add EX, 16 ;extra 16. out 14, EX ;turn by difference to desired heading. out 11, 100 ;forward, full throttle. jmp !scan ;return. !lwalll mov EX, 112 ;desired heading. sub EX, @1 ;difference from current heading. out 14, EX ;turn by difference to desired heading. out 11, 100 ;forward, full throttle. jmp !scan ;return. !rwall cmp @1, 128 ;error checking jgr !scan ;robot was moving away anyway. cmp @1, 64 ;Is tank heading up or down oblique to wall? jgr !rwallr ;If up, turn right. Else: jle !rwalll ;down, turn left. !rwallr mov EX, 144 ;desired heading. sub EX, @1 ;difference from current heading. out 14, EX ;turn by difference to desired heading. out 11, 100 ;forward, full throttle. jmp !scan ;return. !rwalll mov EX, 0 ;desired heading. sub EX, @1 ;difference from current heading. sub EX, 16 ;-16 extra out 14, EX ;turn by difference to desired heading. out 11, 100 ;forward, full throttle. jmp !scan ;return. !dwall cmp @1, 128 ;Is tank heading r/l oblique to wall? jgr !dwallr ;If right, turn right. Else: jle !dwalll ;left, turn left. !dwallr mov EX, 208 ;desired heading. sub EX, @1 ;difference from current heading. out 14, EX ;turn by difference to desired heading. out 11, 100 ;forward, full throttle. jmp !scan ;return. !dwalll mov EX, 48 ;desired heading. sub EX, @1 ;difference from current heading. out 14, EX ;turn by difference to desired heading. out 11, 100 ;forward, full throttle. jmp !scan ;return. !uwall cmp @1, 128 ;Is tank heading r/l oblique to wall? jge !uwalll ;If l, turn l. Else: jle !uwallr ;r, turn r. jmp !uwallr ;else, left. !uwallr mov EX, 80 ;desired heading. sub EX, @1 ;difference from current heading. out 14, EX ;turn by difference to desired heading. out 11, 100 ;forward, full throttle. jmp !scan ;return. !uwalll mov EX, 176 ;desired heading. sub EX, @1 ;difference from current heading. out 14, EX ;turn by difference to desired heading. out 11, 100 ;forward, full throttle. jmp !scan ;return. !fireadj ;adjusted firing routine. out 12, bx ;move turret. out 15, 0 ;fire w/ new angle. out 15, 0 ;fire w/ new angle. out 15, 0 ;fire w/ new angle. jmp !lock