;Robot EHEU, programmed by Jude Hungerford. Work started on 1/11/2000. ;Last modified on 17/11/2000. ;Version 0.20 ;This program is in the public domain, but I'd appreciate it if you gave me ;credit if you derive anything interesting from it, or use any code from it, ;or ideas, or whatever. Also, please consider making your robot's source ;available to all of us, as I have. ;The 'bot takes ideas from Zitgun, Lynx, and probably a whole heap of other ;robots who I've watched fighting. The most obvious thing I've used from ;other robots is the scanning technique. ;notes on the robot: I'm starting out with a semi-hierarchical approach, but ;I find that doesn't work as well as I'd like with this game, so I might move ;to a more decentralised structure later. ;DX = scan width. ;I think I've written this robot's components in a better order than I have ;in the past. I think that going for movement, then radar, then gun is a good ;approach, because the effectiveness of the latter ones is dependent on ;having the former working well. A radar routine that works well mounted on ;a stationary robot may fail when the robot starts driving around. ;Modlist: ;version 0.16: I've just moved the modlist into its own file. If you want to ;see it for some reason, please email me at lichen_dragon@my-deja.com . ;0.16 - 0.17: ;Moved second mine laying to after init stuff to spread the mine out. ;Also experimenting with further tweaks to firing routine. ;0.17 - 0.18: ;0.17 seems to have a similar or better hit %age than Lynx, which is good. ;Now I need to make it fire a little more. I'll just start by adding another ;shot into the firing routine and increasing the heat threshhold. ;That sees to have improved it. ;0.18 - 0.19: ;I'm still trying to do proper calculations for firing offsets. For the ;moment, I'm just adding code to make it fire overburn shots at stationary ;targets. ;Having done that, and seen that it worked well, I've also added some new ;tweaks to the firing offsets which seem to have worked. ;0.19 - 0.20: ;More firing tweaks. ;Which failed rather badly. Tweaking again, differently. ;That seems to have worked. !init #config scanner= 3 #config weapon= 2 #config armor= 3 #config engine= 3 #config heatsinks= 1 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. put 0, 400 ;Firing offsets. put 1, 401 put 2, 402 put 4, 403 put 5, 404 put 6, 405 put 6, 406 put 7, 407 put 7, 408 put 7, 409 put 7, 410 put 6, 411 put 4, 412 put 2, 413 put 1, 414 put 0, 415 put 0, 416 put -1, 417 put -2, 418 put -4, 419 put -5, 420 put -6, 421 put -7, 422 put -7, 423 put -7, 424 put -7, 425 put -6, 426 put -6, 427 put -5, 428 put -4, 429 put -2, 430 put -1, 431 put 0 432 out 22, 7 ;lay mine, trigger 7. !path cmp @9, 685 ;Have we travelled 685 metres? jgr !steer ;if yes, steer. int 12 ;collisions? cmp FX, 0 jgr !crash ;if yes, respond to crash. jmp !scan !steer int 19 ;clear meters count. out 14, -64 ;turn 64 degrees left. jmp !path ;check steering again (for collisions) !crash out 11, -75 ;reverse del 5 ;wait 5. out 14, -32 ;turn 32 degrees left. out 11, 100 ;forward, full throttle. int 13 ;reset collision count. int 19 ;clear meters count. jmp !path ;check steering again. !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, 120 ;too hot? jgr !lock ;if yes, lock. Else: cmp @7, 0 ;Is target stationary? je !statfire ;if yes, fire at stationary target. Else: jmp !movfire ;fire at moving 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. !movfire mov bx, @6 ;BX=heading of enemy. shr bx, 3 ;bx/=8 add bx, 400 ;bx+=400 (for memory addressing) get bx, bx ;bx = contents of memory location bx. 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 !lock in 7, BX ;scan cmp @3, 0 ;is it dead centre? je !path ;if yes, return to path. Else: out 12, @3 ;adjust turret jmp !path ;and path.