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
Metadata
Release files for battle-box-client 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| battle_box_client-0.0.2.tar.gz | 5.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| battle_box_client-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.4 kB
Release files / battle_box_client-0.0.2.tar.gz
| Download URL | battle_box_client-0.0.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f1b2b36e27212a865496fdd7d38b4581762ca82eaf6470a8c18c05118757b02
|
|
BLAKE2b-256 checksum How to use checksums |
a1b50858d81d2844b4b41c3c4f2d6e89bd83a87ebf5e00d1da5d54dd11a0c4d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / battle_box_client-0.0.2-py3-none-any.whl
| Download URL | battle_box_client-0.0.2-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01cfa5a0bf807aa40fdd7f1fa14838a2f8f53a1ed1f2e372cb55d89060ab0f1f
|
|
BLAKE2b-256 checksum How to use checksums |
ae2614697440325a947a696ab17f85431ecb4a305d762e42eeb56a0d389d1cc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for battle-box-client 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.