By Kawigi - hopefully also looked over/edited by Rozu
Rozu released the source to his breakthrough melee bot, HawkOnFire, when he saw that people were genuinely interested in it some time ago, but hasn't packaged it with the bot. Since then, I think it's been on everyone's todo list to take a look at it. You can go see by going to http://www.robocoderepository.com/BotDetail.jsp?id=1575 and clicking on "Download Source". If I refer to the source, I'll be referring to that source. It appears that Rozu took some time to edit and fix up the code before uploading it here, and for the benefit of clarity, it compiles to be a bit larger than the barely-micro size that HawkOnFire normally is. That having been said, with some analysis and tweaking, I got HawkOnFireOS? under 700 bytes with no loss of functionality or performance that I can tell (so if you have something to use 50 bytes for, Rozu, let me know).
HawkOnFire also overrides the onRobotDeath? method to mark enemies as dead.
The primary magic in HawkOnFire lives in the evaluate and doMovementAndGun? methods. run doesn't do much besides set up and call these methods, and onScannedRobot just updates the enemies and handles target selection.
Which leads us into evaluate itself. Basically, after starting out the risk as addLast times an antigravity function on lastPosition, Rozu iterates through the enemies, and for each live one, adds the proposed risk to the total risk (called eval). The formula is very simple and elegant (and I don't think I'm exaggerating to say that it's a breakthough in and of itself) - simply energy ratio * (1 + perpendicularity) / distanceSq.
Once you understand this formula, you pretty much understand HawkOnFire.
Great. Haven't read it yet, but I just must comment one of the first statement - "I think it's been on everyone's todo list to take a look at it." Ha! I have never even considered taking a look at it until this page came up. Now though I just might. Just need to fail in a few attempts at melee movements myself first. -- PEZ
I rather read pages like this than to look at the code. When looking at the code, I just see the code. When reading a description like above, I form my own ideas and try to implement them the way I see fit. Ofcourse once in a while I also copy things (like teamcommunication, circular targeting) but I still try to adapt and improve them to my needs. This is yet another excellent page. I wish that I could a) write such clear and informative page and b) write such sophisticated and competetive bot. -- GrubbmGait
Code or prose. Not too much difference for me (as long as the code is somewhat readable). It's just that I don't want to get to "coloured" by other peoples ideas before I try myself. I want to get those "ahhhh!" feels when I later try look at how people have approached the problems I have stumbled across. -- PEZ
I do not know if this has been said yet, but welcome back kawigi. Good to see you around the game still. -- jim
Nice page! I don't think that I have something to edit here. But anyway, I'm open to answer any questions as required. -- rozu