Develop game playing code on your own machine and play games using the REST API
We have created a complete GUI interface that uses the REST API to play a game. This allows you to develop code on your own machine rather than using the Online Code Editor.
This serves as an option to have more control over the Python libraries that you use and to be able to use your local resources for development. It is also a complete example of how to use our REST API.
Visit the Downloads page to download the appropriate demo client for the development environment you want to use. Each download will also come with a readme file that will give some instructions on how to get the client running.
Once you run the client in python you will be presented with a screen shown below:
First enter your bot id and password to login. All accounts have a bot id automatically created as:
– so for example mat007-defbot if your user name was mat007. The default bot uses your user account password.
Each user account can have multiple bot ids. A bot id may be logged in on multiple client programs at the same time. You can add new bot ids, change their passwords and move currency among bots and your user account using the Bot Management screens on the web interface.
You will see a screen such as
The current balance of your bot is shown on the top line e.g. 6,298.
The drop down box below the login details allows you to select what game type you want to play as shown below:
The Specify Opponent text box allows you to specify that you wish to play a particular opponent. If you leave this blank, you will play the next available bot.
First choose the type of game you want to play. In this example we are going to play battleships.
In the list box, you see the various game styles available.
Double clicking a game style line means you are offering to play a game of that style. You will either be immediately matched to an opponent if there is one waiting, or you will wait for an opponent to offer to play you.
In the latter state, a button appears “Cancel Game Offer” which allows you to cancel your offer.
To see a list of bots waiting to play browse to the aigaming site and locate the offered games list from that games homepage eg Battleships.
In most cases there will be plenty of housebots to test your bot against. To play a house bot you must enter the housebot name in the specify opponent field. Each of the housebots vary in ability and will be named as follows:
housebot-practise - The easy bot will often just make completely random guesses at the solution, move or play. Use this bot to test your initial designs. This bot will not normally offer any stake level other than 0mA to play.
housebot-competition - The bot used for normal play and many of our competitions. This bot will implement a basic strategy and will offer a reasonable level of opponent in our games. Small stakes are offered when playing against this bot.
housebot-master - The best bot we currently have. Think your up to a challenge try our master bot which offers the highest stake games.
The Add “Thinking Time” text box allows you to enter an artificial delay into how fast your client plays the game. Setting this value to 0 plays the games as fast as possible, but you may find it useful in testing to set this higher to allow you to view the game as it progresses. However, the client must respond to the server within the timeout specified in the game style, or the bot will immediately lose the game.
The Play another game when complete checkbox allows you to continuously play games of the style you selected. When one game is complete, your client will automatically offer another game of the same style.
Once you begin to play a game, you will see a screen such as this:
The details of the game are shown in the top of the animated play area. A status message appears at the bottom of the animated play area.
Once one game is complete, the result is shown in the lower left of the client interface as “Last game result”.
You can click the Stop Game button to force a game to stop, but you will lose in this case.