Thursday, September 16, 2010

Competative Robocode

Overview:
This is the second AI programming assignment I've come across at school.  Generally I find these assignments to be both very frustrating and rewarding (depending on if it does what you want or not!)  Some of the things I wanted to implement didn't seem very difficult, but when you take the math that is involved, it can be hard to get the right results.

Design:
Movement:
The movement system I implemented this bot is very simple.  For the most part it will try to move in a straight line in intervals equal to half of the stage width/height.  When it hits a wall it will attempt to turn around 180° before moving again.  This can be bad sometimes if it manages to get itself stuck in a corner.

Targeting:
This bot has a fairly decent targeting system which I took from my Boom04 bot.  It will lock on the first target it scans.

Firing:
Firing on every scan can be in efficient, especially the shots are missing.  In order to make up for this there is a counter that will stop the bot from firing until it runs out of energy.  Bullet strength/speed is determined by distance to target.  The closer the target is, the stronger the bullet.

Win results against a few sample robots:
vs Sitting Duck: 100%
vs Corners: ~60%
vs Crazy: ~70%
vs Fire: ~ 50%
vs RamBot: ~60%
vs SpinBot: ~ 50%
vs Tracker: ~70%
vs Walls ~40%

Lessons Learned:
Designing a bot for the first time can be a little daunting.  I think for the first attempt you should try and keep it very simple, and build your way up from there.  I wish I knew more trigonometry so that I could express some features I would have liked my robot to have, (i.e. - predictive targeting).

Download: www2.hawaii.edu/~gaskell/ahg.CakeBot_1.0.jar

BattleBots