Robot Rumble ALPHA
discord
try it!
boards
tutorial
docs
login
/
signup
import random def robot(state, unit): enemies = state.objs_by_team(state.other_team) allies = state.objs_by_team(state.our_team) closest_enemy = min(enemies, key = lambda e: e.coords.distance_to(unit.coords) ) closest_ally = min(allies, key = lambda e: e.coords.distance_to(unit.coords) ) direction = unit.coords.direction_to(closest_enemy.coords) direction2 = unit.coords.direction_to(closest_ally.coords) print(direction) print(direction2) num_around = 0 for direction in [Direction.East, Direction.North, Direction.West, Direction.South]: obj = state.obj_by_coords(unit.coords + direction) if obj is not None and obj.obj_type == ObjType.Unit: num_around += 1 if num_around >= 2: if unit.health > 2: if unit.coords.distance_to(closest_enemy.coords) == 1: return Action.attack(direction) else: return Action.move(direction) else: return Action.move(direction.opposite) else: return Action.move(direction2)
Made with <3 by Anton and Noa
github org