;Robot EHEU, programmed by Jude Hungerford. Work started on 1/11/2000. ;Last modified on 22/12/2000. ;Version 0.58 ;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.43 - 0.44: ;It now fires an extra shot in its firing routine. ;I really should fix the sticking on walls bug. ;That didn't work against fast-moving enemies, so I'm removing it. ;fixed up the !lock code a little. ;0.44 - 0.45: ;Fixing the problems with sticking on walls. ;Worked with my second idea. The first failed. It still sticks on walls, but ;much less often. I'll try to fix it completely someday. The next task, ;though, is quite a large one- make it modify its firing adjustment angles ;during the game. It should be possible, but the coding will be hard. ;0.45 - 0.46: ;Adding the dynamic firing adjustment change code. Well, figuring out how to ;do it and then writing it, rather- it's not quite as simple as just adding ;some new code, sadly. ;I've done some preliminary code reorganisation to prepare for it. That's all ;for this version. ;0.46 - 0.48: ;0.47 didn't work, but might still have some interest. I'm skipping it for ;the moment, though. ;I've just found out that the new steering code changes actually make it ;stick on the walls all the time. Damn. I'll fix that now. ;0.48 - 0.49: ;Not really fixed yet. Making more adjustments. ;Still not fixed, but improved slightly. ;0.49 - 0.50: ;Currently, it's normally "best marksman" but also "most conservative". I'd ;like to try to speed up the radar scanning code, and I might try to further ;improve the accuracy. ;I've improved the radar scan code. Firing adjustments for next version. ;0.50 - 0.53: ;Intermediate versions were steps back, so I'm skipping them. ;0.53 - 0.54: ;I wrote some new driving routines for another robot called Nero (who I am ;going to leave for the moment...). I like these driving routines, and am ;going to incorporate them into Eheu to see what happens. ;They were written for a very fast-moving robot, which Eheu isn't and hasn't ;been for quite some time. I think fast 'bots are probably fundamentally ;better, but it depends on exactly how fast they are... I'll try this with ;Eheu's current configuration, but then I might try some other configs. ;Definitely looks like an improvement. ;0.54 - 0.57: ;Skipping intermediate versions of robot because they were bad. ;I've a new idea for allowing the scanner to lock onto really fast robots: ;if they move above a certain speed, when I narrow the arc, I employ the ;firing routines' target prediction to keep the lock. ;0.57 - 0.58: ;Now I'm replacing most of the !path jumps to !lock jumps to further help the ;radar locking, and adding a "fire wide" function to fire a spread of bullets ;against fast targets. !init #config scanner= 3 #config weapon= 3 #config armor= 4 #config engine= 0 #config heatsinks= 2 #def wpc #def ang #def fen 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. ; add @9, 700 ;say we've travelled far. ; jmp !checkpos ;determine where to go. !steer int 19 ;clear meters count. jmp !checkpos ;steer. !scan mov fen, 0 in 7, BX ;scan cmp BX, 1500 ;anyone in sight? jge !nonefound ;adjust scan arc to suit. jls !arcmodf ;modify arc & fire. !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 !lock ;else, lock. !accright out 12, DX ;turn radar right by scanarc. cmp @3, 2 ;is it out by +2? jls !lock ;if less, lock. mov BX, DX ;Else: BX=DX shr BX, 1 ;BX=25%DX out 12, BX ;turn radar right by 150% scanarc. cmp @13, 600 ;Is enemy really fast? jls !lock ;if no, lock. Else: mov bx, @6 ;BX=heading of enemy. shr bx, 3 ;bx/=8 cmp bx, 16 ;greater than 128 degrees? (negative offset?) jgr !rscanoffsetn ;yes, jump to section. add bx, 385 ;bx+=385 (for memory addressing) get cx, bx ;cx = contents of memory location bx. out 12, cx ;turn radar. cmp dx, 4 ;was arc 8 or less? jgr !lock ;If no, lock. Else: mov fen, 1 jmp !fire ;fire a wide spread of bullets. !rscanoffsetn mov ax, bx ;ax=bx } mov bx, 32 ;bx=32 } Invert BX. sub bx, ax ;bx=32-bx } add bx, 385 ;bx+=385 (for memory addressing) get cx, bx ;see above neg cx ;negate cx. out 12, cx ;turn turret. cmp dx, 4 ;was arc 8 or less? jgr !lock ;If no, lock. Else: mov fen, 1 jmp !firewide ;fire a wide spread of bullets. !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 !lock ;if more, lock. neg BX ;Else: BX=DX shr BX, 1 ;BX=DX/4 neg BX ;BX=-5dx/4 out 12, BX ;turn radar left by 150% scanarc. cmp @13, 600 ;is enemy really fast? jls !lock ;If no, lock. Else: mov bx, @6 ;BX=heading of enemy. shr bx, 3 ;bx/=8 cmp bx, 16 ;greater than 128 degrees? (negative shot?) jgr !lscanoffsetn ;yes, jump to section. add bx, 385 ;bx+=385 (for memory addressing) get cx, bx ;cx = contents of memory location bx. neg cx ;negate cx. out 12, cx ;turn radar. cmp dx, 4 ;was arc 8 or less? jgr !lock ;If no, lock. Else: mov fen, 1 jmp !firewide ;fire a wide spread of bullets. !lscanoffsetn mov ax, bx ;ax=bx } mov bx, 32 ;bx=32 } Invert BX. sub bx, ax ;bx=32-bx } add bx, 385 ;bx+=385 (for memory addressing) get cx, bx ;see above out 12, cx ;turn turret. cmp dx, 4 ;was arc 8 or less? jgr !lock ;If no, lock. Else: mov fen, 1 jmp !firewide ;fire a wide spread of bullets. !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 ;250