Bug

From Robowiki
Jump to navigation Jump to search

Found one in Robocode? Report it here!


Bugs in Robots

The most common thing a person has to do while writing a bot is debugging it. A bug is an undesired effect caused by unforeseen consequences, such as accidentally having your bot disabled because you didn't realize that method called itself >10,000 times somehow, or your gun only fires north. Many bugs are removed or fixed by rewriting parts of your code, usually small mistakes, or even rewriting entire methods. The most common thing to look out for is the undesired effect. Once you know that, you know which part of your code is going wrong. For example, your gun fires at only 0 degrees somehow. You look in your firing method and find this (this is only an example):

val = e.getBearing()*-1; 
val2 = linearShot() + offset; 
... 
fireAt(e.getBearing() + val);


Well, from the looks of it, you meant to use val2 instead of val. You change it, and hey! Your bot works great. Of course it isn't always as simple as this, so watch out.

Bugs in Robocode

This article is a stub. You can help RoboWiki by expanding it.