How to write a bot
All about Maps
Winbots API and Tips
Common Errors

Here are the steps to write your own bot and run it. Of course, you must have downloaded the file and unzipped it to a directory, say winpackage.

Writing and Compiling:
1. First set the classpath to the winbots.jar file in the winpackage directory. This guide is written with Windows users in mind. Other platform users simply substitute the shell prompt with your own.
	For eg.
	C:\>cd winpackage
	C:\winpackage>set classpath=%classpath%;winbots.jar;
2. In your source file, import the winbots package as
	import winbots.*;
3. Write a Java class to extend BaseBot and start by writing your code in the start method. It should look like this
	import winbots.*;

	public class MyFirstBot extends BaseBot
		public void start()
			init("My First Bot");
4. Compile the source file. If it says winbots package is not found, or BaseBot is missing, ensure you've set the classpath correctly.
5. Run the combat server, giving the map and your bot as arguments as
	C:\winpackage>java winbots.BotRunner samplemap.txt MyFirstBot
That's it. A window should now open up, showing the map graphically. Your bot should get loaded in one of the load locations and should start doing whatever you've programmed it to do. The game runs to 100 seconds, and at the end, the battleground screen is closed and a new window reporting the result opens up.

Important Details:
  1. Each bot class you write MUST derive from the BaseBot class and MUST be declared public. (ie). Your bot class should look like
    		public class [BotName] extends BaseBot
    where [BotName] is the name of your class.
  2. Winbots calls the start() method in your Bot as the standard initial function, just like main() is to a C program. So your bot code should begin from start(). For eg,
    	public class  extends BaseBot
    		public void start()
    Of course, you can call your own functions from start(). Functions you can call (like init() above) are listed here. You MUST override start(), otherwise the program won't compile.
  3. Winbots maps have origin as top left coordinate. That means the top left coordinate of the map is zero. To find out the actual coordinates of the points in the map, you may use any editor that supports line and column number viewing.
  4. The game time is 100 seconds.
Running Winbots:
The syntax is
	C:\winpackage>java winbots.BotRunner [mapname] [botname1] [botname2] ..
where [mapname] is the filename of the map file. [botname] is the CLASS file of the bot (without the .class extension.) You're not restricted to one or two bots. You can give as many bots as there are load locations in the map.
For eg,
	C:\winpackage>java winbots.BotRunner samplemap.txt FirstBot SecondBot
This will load samplemap.txt as the map file and bots FirstBot and SecondBot as the competing bots. You can also run a single bot as
	C:\winpackage>java winbots.BotRunner samplemap.txt FirstBot