Client

class vindinium.Client(key, mode='training', n_turns=300, server='http://vindinium.org', open_browser=False)[source]

Bases: object

Base client for Vindinium.

Example

Pass the configuration within constructor:

client = vindinium.Client('<botskey>', mode='training')

Or manually set the client attributes:

client = vindinium.Client()
client.key = '<botskey>'
client.mode = 'training'

Finally, run the bot passing it as parameter to the run method:

client.run(MyBot())
key

str

the bot’s key, you must create a key in the site.

mode

str

the game mode (‘training’ or ‘arena’), defaults to ‘training’.

n_turns

int

number of turns in a game. Only valid in training mode; arena is fixed to 300. Defaults to 300.

server

str

the address of the server. Defaults to ‘http://vindinium.org‘.

open_browser

bool

if True, the client will open the default browser to show the current game. Defaults to False.

timeout_move

int

movement timeout in seconds. Defaults to 15 seconds.

timeout_connection

int

connection timeout in seconds. Defaults to 10 minutes.

__init__(key, mode='training', n_turns=300, server='http://vindinium.org', open_browser=False)[source]

Constructor.

Parameters:
  • key (str) – the bot’s key, you must create a key in the site.
  • mode (str) – the game mode (‘training’ or ‘arena’), defaults to ‘training’.
  • n_turns (int) – number of turns in a game. Only valid in training mode; arena is fixed to 300. Defaults to 300.
  • server (str) – the address of the server. Defaults to ‘http://vindinium.org‘.
  • open_browser (bool) – if True, the client will open the default browser to show the current game. Defaults to False.
run(bot)[source]

Connects to the server waiting for a game.

Parameters:bot (instance) – the bot object.
Returns:A url to watch the game replay.