Robot Rumble ALPHA
discord
try it!
boards
tutorial
docs
login
/
signup
import random def closest_unit_by_team(state, unit, team=None): if team is None: team = state.other_team return tuple(sorted(state.objs_by_team(team), key=lambda obj: unit.coords.distance_to(unit.coords)))[0] random_direction = lambda: random.choice([ Direction.North, Direction.East, Direction.South, Direction.West]) directions = {} dir_of = lambda unit: directions.get(unit.id, random_direction()) def robot(state, unit): if state.turn == 0: directions[unit.id] = random_direction() if state.turn % 4: return Action.move(dir_of(unit)) else: self_dir = dir_of(unit) directions[unit.id] = [self_dir.rotate_cw, self_dir.rotate_ccw][int(unit.id)%2] return Action.attack(unit.coords.direction_to(closest_unit_by_team(state,unit).coords))
Made with <3 by Anton and Noa
github org