; Pi Bot! ; --not yet complete(!) ; --okay in 1-on-1, great in chaos! ; written by Chris King #config scanner=3 #config weapon=1 ;0 normal, 1 chaos #config armor=5 #config engine=0 ;2 normal, 0 chaos #config heatsinks=3 ;2 normal, 3 chaos #config shield=0 #config mines=0 #msg Ha ha ha! #def gostr #def lastblip #def rotdir #def scanr #def scanl #def cdir #def throttle ;mov gostr,1 ;to make him go straight instead of turning opo 17,50 ;scanner arc=50 mov scanr,50 mov scanl,-50 mov ax,1 int 3 ;keepshift on mov cdir,5 mov throttle,100;throttle at 100% !loop int 11 ;check if being fired at cmp ex,20 jgr !chkfire2 mov ax,1 ;overburn to run away faster! int 4 opo 14,cdir ;turn some mov gostr,12 ;move fwd 12 jbe !loopp2 !chkfire2 cmp ex,100 ;if in saftey jls !loopp2 mov ax,0 ;then turn overburn off int 4 !loopp2 inc lastblip ;increase time since last sighting cmp lastblip,50 ;check if nobody found jls !checkarmor mov lastblip,0 ;reset counter mov gostr,12 ;move fwd 12 !checkarmor ;ipo 6,ax ;self-destruct - for chaos mode ;cmp ax,5 ;check if almost dead ;jgr !checkcoll ;mov ax,1 ;overburn for more damage! ;int 4 ;opo 22,20 ;drop mines! ;opo 22,20 ;int 0 ;self destruct! HA HA HA! ;!checkcoll int 12 ;check if collision int 13 cmp fx,0 jeq !move cmp throttle,0 ;which way are we headed? jls !movef mov throttle,-75;go backwards !checkcoll2 opo 14,cdir ;turn some mov gostr,12 ;move fwd 12 !move opo 11,throttle ;set throttle cmp gostr,0 ;go straight? jeq !circles dec gostr ;comment out to make him go straight instead of turning cmp gostr,0 jgr !look neg cdir ;go the other way mov throttle,100;go forwards !look gsb !chkscan ;check scanner cmp ax,1500 ;in range? jgr !scan10 mov rotdir,@3 ;find accuracy mov ax,scanr add ax,2000 jbe ax !look2 opo 12,rotdir ;follow target ipo 2,ax ;check heat cmp ax,80 jae !fire ;if cool opo 15,0 ;fire a little bit opo 15,0 ;fire a little bit !fire opo 17,10 ;shrink scanner arc mov scanr,10 mov scanl,-10 gsb !chkscan ;scan cmp ax,1500 ;in range? jgr !scan50 mov lastblip,0 ;reset counter mov rotdir,@3 ;find accuracy mov ax,rotdir shl rotdir,2 add rotdir,ax opo 12,rotdir ;follow target ipo 2,ax ;check heat cmp ax,80 jae !fire1p2 ;if cool opo 15,0 ;fire a little bit opo 15,0 ;fire a little bit !fire1p2 opo 17,2 ;shrink scanner arc mov scanr,2 mov scanl,-2 gsb !chkscan ;scan cmp ax,1500 ;in range? jgr !scan10 mov rotdir,@3 ;find accuracy opo 12,rotdir ;follow target ipo 6,ax ;compute how much heat should be allowed before not firing shl ax,1 neg ax add ax,280 ipo 2,bx ;check heat cmp bx,ax jae !loop ;if cool, fire! !fire2 mov bx,@13 ;get target's speed shr bx,7 add bx,1000 ;a neat idea stolen from Zit Gun! mov ax,1 ;overburn for more damage! int 4 jeq bx ;fire slim or wide! jne bx !fire3 mov ax,0 ;turn overburn off int 4 jae !loop !scan10 cmp scanr,10 jae !scan50 opo 17,10 ;widen scanner arc mov scanr,10 mov scanl,-10 jls !loop !scan50 cmp scanr,50 jae !rotate opo 17,50 ;widen scanner arc mov scanr,50 mov scanl,-50 jls !loop !rotate cmp rotdir,0 ;which way should I look? jls !rleft opo 12,scanr ;look right! jae !loop !rleft opo 12,scanl ;look left! jls !loop !circles opo 14,cdir ;go in circles! jeq !look :1000 opo 11,0 ipo 6,ax shr ax,3 neg ax add ax,12 do ax !f0loop opo 15,0 loop !f0loop opo 11,throttle jeq !fire3 jne !fire3 :1001 opo 11,0 ipo 6,ax shr ax,5 neg ax add ax,3 do ax !f1loop opo 15,2 opo 15,-2 opo 15,1 opo 15,-1 opo 15,0 loop !f1loop opo 11,throttle jeq !fire3 jne !fire3 :1002 opo 15,1 opo 15,-1 opo 15,0 jeq !fire3 jne !fire3 :1003 opo 15,1 opo 15,-1 opo 15,0 jeq !fire3 jne !fire3 :1004 opo 15,1 opo 15,-1 opo 15,0 jeq !fire3 jne !fire3 :2002 jbe !look2 :2010 mov ax,rotdir shl rotdir,2 add rotdir,ax jbe !look2 :2050 mov ax,rotdir shl rotdir,1 add rotdir,ax shl rotdir,3 jbe !look2 !movef mov throttle,100;go forward jls !checkcoll2 !chkscan ipo 7,ax ;check scanner cmp ax,1500 ;if too close jbe !moveaway ;then move away ret !moveaway mov bx,@2 sub bx,127 ;which way should I turn? sub bx,@1 opo 14,bx ;turn! cmp ax,100 ;if really close jgr !rfma ipo 22,bx ;and have mines cmp bx,0 jeq !rfma opo 22,20 ;then lay a mine !rfma ret