Robot Rumble ALPHA
discord
try it!
boards
tutorial
docs
login
/
signup
import random # coords representing the center of the board def robot(state, unit): enemies = state.objs_by_team(state.other_team) closest_enemy = min(enemies, key=lambda e: e.coords.distance_to(unit.coords)) if unit.coords.distance_to(closest_enemy.coords) == 1: return Action.attack(unit.coords.direction_to(closest_enemy.coords)) else: team_position_list = [enume.coords for enume in state.objs_by_team(state.our_team)] chosen_dir = random.randint(0, 3) if (chosen_dir == 0): move_dir = unit.coords.direction_to(Coords(unit.coords.x, unit.coords.y+1)) elif (chosen_dir == 1): move_dir = unit.coords.direction_to(Coords(unit.coords.x, unit.coords.y-1)) elif (chosen_dir == 2): move_dir = unit.coords.direction_to(Coords(unit.coords.x+1, unit.coords.y)) else: move_dir = unit.coords.direction_to(Coords(unit.coords.x-1, unit.coords.y)) return Action.move(move_dir)
Made with <3 by Anton and Noa
github org