class PlaceArmiesCmd(OutputCommand): """Parameter string: Space separated list of bot name, the string place_armies, region, number of armies""" pattern = "(\w+) place_armies (\d+) (\d+)" def __init__(self, line): match = re.search(PlaceArmiesCmd.pattern, line) self.__placedArmies = Deployment(match.group(1), match.group(2), int(match.group(3))) def placed_armies(self): return self.__placedArmies def output(self): return self.__placedArmies.output()
def __init__(self, line): match = re.search(PlaceArmiesCmd.pattern, line) self.__placedArmies = Deployment(match.group(1), match.group(2), int(match.group(3)))