Package: battle-box-client
Battle Box Client (Python3)Getting StartedInstallationpip3 install battle-box-clientThe Basicsbotskrieg.com currently hosts the offical battlebox docsGetting Started GuideGamesRobotGameCheckout the example bots in this fileA basic robot game bot is any class that subclasses theRobotGameBotclass and defined acommandsmethod that takes three arguments. The following bot will return anfrombattle_box_clientimportRobotGameBot# Define your BotclassMyBot(RobotGameBot):NAME="my-bot"defcommands(self,commands_request,settings):my_commands=[]returnmy_commands# Run your botbot=MyBot(token="{PUT YOUR TOKEN HERE (SEE GETTING STARTED GUIDE)}")# Practice Matchesbot.practice()# Practice with random ai in default arenabot.practice(arena="robot-game-default")# Run your bot in a specific arenabot.practice(opponent="kansas")# Run your bot against a specific opponent# Match Make Against Other User's Online Botsbot.match_make()# match make in default arenabot.match_make(arena="robot-game-default")# Match make in a specific arenaOnce per turn your bot'scommandsmethod will be called with thecommands_requestandsettingsof the game, your method is expected to return a list of commands you'd like to send to the serverInside the commands requests are the following fieldsmore details in official docsclassMyBot(RobotGameBot):NAME="my-bot"defcommands(self,commands_request,settings):# commands_request has the following keys# commands_request["player"] <- Your player in this game (Integer)# commands_request["turn"] <- the turn this commands request is for (Integer)# commands_request["my_robots"] <- Your robots, instances of the RobotGameBot.Robot class# commands_request["enemy_robots"] <- Enemy robots, instances of the RobotGameBot.Robot class# settings has the following keys (see offical robot game docs for more details)# https://botskrieg.com/docs/games/robot-game# settings["attack_damage_max"]# settings["attack_damage_min"]# settings["collision_damage_max"]# settings["collision_damage_min"]# settings["explode_damage_max"]# settings["explode_damage_min"]# settings["max_turns"]# settings["robot_hp"]# settings["spawn_every"]# settings["spawn_per_player"]# settings["terrain"] <- An instance of the RobotGameBot.Terrain classreturn[]TheRobotGameBot.Terrainclass lets you do the following thingsterrain.rows# number of rows in the terrainterrain.cols# number of cols in the terrainterrain.manhattan_distance(loc1,loc2)# manhattan distance between two locationsterrain.towards(loc1,loc2)# returns the next step loc1 can take in order to reach loc2terrain.at_location(loc)# returns the type of terrain at a location is either ["inacessible", "normal", "spawn"]TheRobotGameBot.Robotclass lets you do the following things# Give information about the robotrobot.location# returns the [x, y] current location of the robotrobot.adjacent_locations# returns the adjacent [x, y] coordinates to the robotrobot.manhattan_distance(location)# returns the manhattan distance to the location https://en.wikipedia.org/wiki/Taxicab_geometry# Create commands for the given robotrobot.guard()# returns a guard command for the robotrobot.explode()# returns a explode command for the robotrobot.attack(some_location)# returns an attack command towards the given location, the location must be an adjacent [x, y] coordinaterobot.move(some_location)# returns a move command towards the given location, the location must be an adjacent [x, y] coordinaterobot.move_towards(some_location)# returns a move command towards a given location, does *not* have to be adjacent