;BHunter 0.02 ;(c) 2002 Philipp Wolfer ; This is my first robot I've programmed. I think it's quite simple, ; just seek and destroy. It navigates quite fine. ; I don't know how it makes up against other robots, perhaps not so bad. ; maximum of 12 points to spend (I can't remeber this ;-)) #msg version 0.02 #config scanner=4 #config weapon=2 #config armor=2 #config engine=4 #config heatsinks=0 #config mines=0 #config shield=0 #def min_scan_range ;minimum scan range #def act_scan_range ;contains allways the active scan range, should be 64 on startup #def avg_speed ;the robots speed #def max_heat ;we don't fire if we are that hot #def min_distance ;don't get closer to the target #def set_new_course ;is used to calculate our new course ;configuration mov min_scan_range, 8 mov act_scan_range, 64 mov avg_speed, 100 mov min_distance, 120 mov max_heat, 300 ;initialize opo P_SCANARC, act_scan_range :1000 opo P_THROTTLE, avg_speed ipo P_SCAN, ax ;ax is range cmp ax, 15000 ;enemy found? ja 1200 ;no, keep on searching jmp 2000 ;yes, start tracking :1200 ;check for arena borders int I_LOCATE cmp ex, 40 jbe 1210 cmp dx, 40 jbe 1210 cmp ex, 960 jae 1210 cmp dx, 960 jae 1210 jmp 1220 :1210 ;turn around to avoid border opo P_STEERING, 12 jmp 1240 :1220 ;set a new course if not already done ipo P_RAND, ax cmp ax, 0 jb 1225 opo P_STEERING, 6 jmp 1230 :1225 opo P_STEERING, -6 :1230 ; ;perhaps we collided with someone? ; int I_COLLISIONS ; cmp fx, 0 ; je 1240 ; opo P_STEERING, 128 ; do 5 ;:1232 ; opo P_FIRE, 0 ; opo P_THROTTLE, -100 ; loop 1232 ; int I_RESETCOLCNT :1240 ;increase scan range cmp act_scan_range, 64 jae 1000 shl act_scan_range, 1 opo P_SCANARC, act_scan_range jmp 1000 ;start tracking :2000 ipo P_ACCURACY, bx ;get scan accuracy cmp bx, 0 ja 2100 ;turning right jb 2200 ;turning left ;enemy must be somewhere in front of us ;we keep direction and try firing cmp act_scan_range, 32 ;is scan good enough? jae 2050 ipo P_HEAT, cx ;we don't want to sweat cmp cx, max_heat jae 2050 opo P_FIRE, 0 opo P_FIRE, -1 opo P_FIRE, 1 :2050 cmp ax, min_distance jae 2300 ;we are very close to our target, avoiding collission opo P_FIRE, 0 ipo P_RAND, dx cmp dx, 26000 ; there is some chance to move left jls 2070 opo P_STEERING, -32 jmp 2300 :2070 opo P_STEERING, 32 ;since we are so close, why don't leave a present? opo P_MINELAYER, 10 jmp 2300 ;keep direction ;turning right :2100 mov set_new_course, act_scan_range cmp bx, 1 ja 2150 ;turning hard right shr set_new_course, 1 :2150 opo P_STEERING, set_new_course jmp 2300 ;turning left :2200 cmp bx, -1 mov set_new_course, 1024 sub set_new_course, act_scan_range jb 2250 ;turning hard left shr set_new_course, 1 :2250 opo P_STEERING, set_new_course jmp 2300 :2300 ;decrease scan range cmp act_scan_range, min_scan_range jbe 1000 shr act_scan_range, 1 opo P_SCANARC, act_scan_range jmp 1000 #END