Using The Online Code Editor
The AI Gaming Online Code Editor lets you create bots and compete with them in seconds.
If this is your first time in the editor, you can simply click the Run button at the top of the page and the sample code that's been pre-loaded into your editor window will play a game of Battleships using your default botname.
How simple was that?
You can immediately start tweaking the code in the editor window and start improving your bot.
There are some basics to know about the code and the options you can choose before you hit the Run button
Any bot you write needs to state its bot name.
Your bot name must be unique. You are assigned a default bot name as soon as you register your account and this default bot name is automatically inserted into your code if you load any of the bot templates for any of the games. You can also create your own bot names by going to the Bot Management screen under My Account and choosing the Create New Bot button at the top right of your list of bots.
You can create a bot that has a more memorable or descriptive name like 'MegaBot' or 'BattlingBehemoth'!
You choose your opponent from the Select Opponent dropdown at the top of the Editor page.
The easiest way to get started is to play against one of our Housebots from the Select Opponents dropdown list. Their names give you a clue as to how they play but if you choose one, you'll soon get a feel for how good they are.
Select one from the dropdown list and try running your bot against them
If you know another person's bot name, or if you want to compete against a friend, you can specify their bot name. You do this by typing their bot name into the Select Opponent dropdown.
If you do this, your bot will wait and it will only play the bot name you have specified. Remember that if the specified bot does not play a compatible game, your bot will sit and wait forever
You can also play any non-housebot player Anyone option from the Select Opponent dropdown. This option means that your bot will play against any compatible bot that is available. A great option when you get your bot's strategy implemented.
Playing yourself lets you get used to running games and, you can play the same bot against itself, or, you can write different versions of a bot and have them play against each other. Just state the name of your own bot in the Select Opponent field and then, in another browser tab or window, load up your bot in the Editor window and enter your first bots name in the Select Opponent field. Click Run oon both the windows and your bots will find each other and start competing.
Another key component is choosing the Game Style or the variant of the game you want to play. Game Styles exist for all of the different games that you can play on the AI Gaming site: Battleships, Noughts And Crosses and more.
For each Game Type, there may be several Game Styles. For example, in the Battleships Game Type, there might be a Game Style that only has 1 ship instead of the usual 5 ships. There might also be a Game Style of Battleships that includes land as well as sea when it creates the playing board.
Different Game Styles add different challenges for your bot, but, it's important to remember that if you try to play a specific bot or your friends bot, you have to play the same Game Style too. If your bot is looking for Game Style 101 and your friends bot is looking for Game Style 102, you won't find each other
No coding would be complete without the ability to debug along the way. To add debug information to your bot, just use the Python print() function. Anything you print will be shown in this Info Display column while your bot is running, and, when your game has finished, you'll be able to see the output from the last game run by clicking on the terminal icon in the right hand column of the Editor page.