name SuperBug3 iff code 666_SB3 author Juk Armstrong ; How many random turns before entering chase again. assign v2 0 ; Assume near at start. raise shield ; for open map. turn right move forward move forward turn left move forward move forward start: ; See if any enemy around us. scan perimeter if scan found enemy then goto killarea ; See if any enemy in front. scan forward if scan found enemy then goto killnear if scan found mine then goto avoidmine ; See if we can hit one with a missile, or find a flag. long range scan if scan found enemy then goto killmissile if scan found flag then goto useflag ; Move forward now. move forward move forward ; See if we hit anything. if bump barrier then goto avoid ; Chase, or turn. if value ~v2 <= 0 then goto chase if value ~v2 > 0 then goto turnrandom goto start ;===================================== ; Will move toward the enemy. ; If enemy is weaker or same only. chase: ; If in a bad way then evade. if no ammo then goto evade if value #cur_life > #enemy_d then goto evade ; Find the distance to nearest enemy. math v0 = #x_pos - #enemy_x if value ~v0 < 0 then math v0 = 0 - ~v0 math v1 = #y_pos - #enemy_y if value ~v1 < 0 then math v1 = 0 - ~v1 ; Goto the one with the most distance. if value ~v0 < ~v1 then goto ctesty ; See which way on the x-axis we want to move. ctestx: if x coordinate is < #enemy_x then goto ctestx1 if value #cur_head = 4 then goto start if value #cur_head = 1 then goto singleleft if value #cur_head = 2 then goto doubleleft if value #cur_head = 3 then goto singleright ctestx1: if value #cur_head = 2 then goto start if value #cur_head = 1 then goto singleright if value #cur_head = 3 then goto singleleft if value #cur_head = 4 then goto doubleright ; See which way on the y-axis we want to move. ctesty: if y coordinate is < #enemy_y then goto ctesty1 if value #cur_head = 1 then goto start if value #cur_head = 2 then goto singleleft if value #cur_head = 3 then goto doubleleft if value #cur_head = 4 then goto singleright ctesty1: if value #cur_head = 3 then goto start if value #cur_head = 1 then goto doubleright if value #cur_head = 2 then goto singleright if value #cur_head = 4 then goto singleleft beep goto start ;===================================== ; Will move away from the enemy. evade: ; Find the distance to nearest enemy. math v0 = #x_pos - #enemy_x if value ~v0 < 0 then math v0 = 0 - ~v0 math v1 = #y_pos - #enemy_y if value ~v1 < 0 then math v1 = 0 - ~v1 ; Goto the one with the least distance. if value ~v0 > ~v1 then goto etesty ; See which way on the x-axis we want to move. etestx: if x coordinate is > #enemy_x then goto etestx1 if value #cur_head = 4 then goto start if value #cur_head = 1 then goto singleleft if value #cur_head = 2 then goto doubleleft if value #cur_head = 3 then goto singleright etestx1: if value #cur_head = 2 then goto start if value #cur_head = 1 then goto singleright if value #cur_head = 3 then goto singleleft if value #cur_head = 4 then goto doubleright ; See which way on the y-axis we want to move. etesty: if y coordinate is > #enemy_y then goto etesty1 if value #cur_head = 1 then goto start if value #cur_head = 2 then goto singleleft if value #cur_head = 3 then goto doubleleft if value #cur_head = 4 then goto singleright etesty1: if value #cur_head = 3 then goto start if value #cur_head = 1 then goto doubleright if value #cur_head = 2 then goto singleright if value #cur_head = 4 then goto singleleft goto start ; ---------------------------------------------- ; Used so we can speed up code for chase and evade. ; Turn left once, then return. singleleft: turn left goto start ; Turn right once, then return. singleright: turn right goto start ; Turn left twice, then return. doubleleft: turn left turn left goto start ; Turn right twice, then return. doubleright: turn right turn right goto start ; -------- ; Fire machine gun forward. killnear: if no ammo then goto veryill lower shield fire weapon fire weapon fire weapon fire weapon fire weapon raise shield scan forward if scan found enemy then goto killnear goto start ; Fire missile. killmissile: if value #cur_ammo < 10 then goto veryill lower shield launch missile if value #cur_ammo < 10 then goto veryill launch missile if value #cur_ammo < 10 then goto veryill launch missile raise shield long range scan if scan found enemy then goto killmissile goto start ; Zap the sourounding area. killarea: if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy if damage is > 90 then goto veryill discharge energy scan perimeter if scan found enemy then goto killarea goto start ; Use a flag (far). useflag: if damage is = 0 then discharge energy againflag: move forward move forward long range scan if scan found flag then goto againflag goto start ; Try to avoid something. avoid: generate random math v2 = #random turnrandom: math v2 = ~v2 - 1 generate random if value #random < 3 then goto singleleft turn right goto start ; Avoid the mine. avoidmine: scan forward if scan found mine then generate random if value #random < 3 then turn left if value #random > 2 then turn right goto avoidmine end if move forward goto start ; In big trouble, so run away! veryill: raise shield turn left move forward move forward move forward if bump barrier then goto rightthen goto start rightthen: turn right turn right move forward move forward move forward goto start