Battle Box Client
Project description
Battle Box Client (Python3)
Getting Started
Installation
pip3 install battle-box-client
The Basics
botskrieg.com currently hosts the offical battlebox docs
Games
RobotGame
Checkout the example bots in this file
A basic robot game bot is any class that subclasses the RobotGameBot
class and defined a commands
method that takes three arguments. The following bot will return an
from battle_box_client import RobotGameBot
# Define your Bot
class MyBot(RobotGameBot):
NAME = "my-bot"
def commands(self, commands_request, settings):
my_commands = []
return my_commands
# Run your bot
bot = MyBot(token="{PUT YOUR TOKEN HERE (SEE GETTING STARTED GUIDE)}")
# Practice Matches
bot.practice() # Practice with random ai in default arena
bot.practice(arena="robot-game-default") # Run your bot in a specific arena
bot.practice(opponent="kansas") # Run your bot against a specific opponent
# Match Make Against Other User's Online Bots
bot.match_make() # match make in default arena
bot.match_make(arena="robot-game-default") # Match make in a specific arena
Once per turn your bot's commands
method will be called with the commands_request
and settings
of the game, your method is expected to return a list of commands you'd like to send to the server
Inside the commands requests are the following fields more details in official docs
class MyBot(RobotGameBot):
NAME = "my-bot"
def commands(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 class
return []
The RobotGameBot.Terrain
class lets you do the following things
terrain.rows # number of rows in the terrain
terrain.cols # number of cols in the terrain
terrain.manhattan_distance(loc1, loc2) # manhattan distance between two locations
terrain.towards(loc1, loc2) # returns the next step loc1 can take in order to reach loc2
terrain.at_location(loc) # returns the type of terrain at a location is either ["inacessible", "normal", "spawn"]
The RobotGameBot.Robot
class lets you do the following things
# Give information about the robot
robot.location # returns the [x, y] current location of the robot
robot.adjacent_locations # returns the adjacent [x, y] coordinates to the robot
robot.manhattan_distance(location) # returns the manhattan distance to the location https://en.wikipedia.org/wiki/Taxicab_geometry
# Create commands for the given robot
robot.guard() # returns a guard command for the robot
robot.explode() # returns a explode command for the robot
robot.attack(some_location) # returns an attack command towards the given location, the location must be an adjacent [x, y] coordinate
robot.move(some_location) # returns a move command towards the given location, the location must be an adjacent [x, y] coordinate
robot.move_towards(some_location) # returns a move command towards a given location, does *not* have to be adjacent
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file battle_box_client-0.0.2.tar.gz
.
File metadata
- Download URL: battle_box_client-0.0.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f1b2b36e27212a865496fdd7d38b4581762ca82eaf6470a8c18c05118757b02 |
|
MD5 | 8189e8bc0385232f6a365b070da4b608 |
|
BLAKE2b-256 | a1b50858d81d2844b4b41c3c4f2d6e89bd83a87ebf5e00d1da5d54dd11a0c4d8 |
File details
Details for the file battle_box_client-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: battle_box_client-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01cfa5a0bf807aa40fdd7f1fa14838a2f8f53a1ed1f2e372cb55d89060ab0f1f |
|
MD5 | 2257ccabfc8d592f886a55f45e4e248d |
|
BLAKE2b-256 | ae2614697440325a947a696ab17f85431ecb4a305d762e42eeb56a0d389d1cc8 |