Bots

From WarfishWiki

Jump to: navigation, search

Example bots process and "data flow" [back to top]

Since this API was original designed for bot designers first I'll go over a brief overview of one process and "data flow" for creating a bot for Warfish.

1. First you need to create a "bot" user account. At this point just use a standard user, invite a test email to a game to create this account.

2. Then contact Warfish support to enable the Warfish APIs for that account

3. Get a Warfish cookie for your bot (see Authentication below).

4. Create a new bot.cgi script and save your cookie into a variable to use when making requests to the XML/API.

5. Then implement bot.cgi that takes the gameid as an argument to utilize the appropriate APIs to make moves. You can test your bot easily by inviting your bot account to a game as usual and just running your script by hand when it is your bot's turn. That way you can fix bugs and make any adjustments along the way.

6. Finally, when your bot.cgi is working, you can copy it onto your web server and setup an http notification url (see Notification below). Then, anyone can invite your bot to play, and it will be notified and make its moves on its own.

[edit] Code Example

Samplebot

Personal tools