[Home]HaikuBot

Robo Home | Changes | Preferences | AllPages

A robot poem, typically 4 lines of code, although there isn't any real restriction. Several can beat the sample bots, and a few can get an occasional win against middle-tier megabots (which is really hilarious to watch).


I am interested in writing one. Are there any guidelines because I understand the 4 lines of code but what is a "robot poem", and can it extend AdvancedRobot? -- Kinsen

Strictly speaking there aren't really any guidelines. Traditional HaikuBots were very small and had 4 useful lines of code, and often immitated one of the sample bots or other well-known bots in some way (I think there was a HaikuTron??). Tobe used to have a page up about them, but I think it's gone now. The thing that made traditional Haikus fun is that they were basically non-competitive (although Tobe ran a league with them once). The only running league for HaikuBots is my RobocodeLittleLeague, where the rules have to be set for competitive purposes - the rule is that you can use no more than 4 semicolons in your code, not including import and package statements, and you can't use for loops (as they create a potential loophole to having semicolons). Quite a few of the haiku entries in the RLL are effective but simple, but a collection are quite complicated - Noteably AresHaiku, whose codesize is over 1600 bytes, and HaikuTrogdor, Escape and MeleeXaxa, which are from about 300-800 bytes of codesize each. Bots like these aren't really compatible with the traditional concept of a HaikuBot, but they're still interesting to play with (just harder to read). As a side, I think the definition of a "middle-tier" megabot has changed since that was written, but then again, the definition of a good HaikuBot has also changed. -- Kawigi

Correct me if I am mistaken, but aren't Haikus 3 lines (5 7 5). Also, for loops should be allowed considering they require the use of 2 semicolons (for(int i = 0; i < 2; i++)) unless there is another way you can use them... -- Jokester

Yes, Haikus are really normally either 3 or 5 lines. In Robocode, though, the term was coined because when Tobe asked who could make the smallest bot that beat the sample bots, he found that almost all entries consisted in the same basic 4 lines in different arrangements, and that's what he named them (even though it's technically one line too long ;-)).

The reason for loops are banned is because the last statement (where you have i++) can be any statement, or several statements delimited by commas. As long as you don't need to loop or anything, you can cram quite a bit of code in there, for a cost of 2 semicolons. The interesting thing about the number 4 is that the original Haikus didn't know how to do anything besides spin their gun, fire, turn and move with that. Newer Haikus can fire without using a semicolon (because fireBullet returns a value, so it can be used in an expression), so that frees up one semicolon for fluff. That means that you can either turn your gun independent of your radar, have a radar lock, or have variables, but not two of those (without sacrificing turning or something). Escape and AresHaiku use the extra semicolon for variables, HaikuTrogdor uses it to aim. The limitation of not being able to do both is significant (it prevents there from being a haiku pattern-matcher, although I did make a 5-semicolon version of FunkyChicken once). -- Kawigi

Your comment about using fireBullet made me remember that variables can be set within an expression and one semicolon would work for setting all the variables in addition to firing and moving or turning. I still think that HaikuBots are rather interesting and if I have the time, I guess I will have a good HaikuBot made soon. Thanks for the comments. -- Kinsen


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited June 8, 2005 23:46 EST by Kinsen (diff)
Search: