I've been a Computer Science student for a handful of years now, even through I've had to learn several different languages and do many different things with said languages, and I’ve never really gotten to do anythings that felt like a game. There were some that came close but nothing close to the simplicity and complexity of Robocode, a Java based tank creation/battle game which uses Java as its control structure. With it implementing the Java coding style and language into simple simulated robot combat but requiring a complex understanding of code and potential to master, Robocode brings a lot of elements to it which expands experience with coding while still allowing simple gratification of getting things to work fast and seeing results.
After taking a look at the official Robocode site (provided above) and acquiring the Robocode install from Sourceforge’s Robocode page, I went through the quick process of installation and the slightly longer process of embedding it into our software engineering class’s choice of IDE, Eclipse. As a personal practice I keep programs installed in their own separate partition of my hard drive as to keep the file path short and keep it separated in the case something bad happens to my OS section. Keeping that in mind I followed the series of instructions provided by the Robocode Wiki, in order to integrate Eclipse and Robocode together.
As part of the assignment for our class we were asked to do a series of robots, doing various motions and actions which show our ability to make these virtual robots and well and make them do things we want to. The instructions we were given can be found on our software engineering Google group.
If you would like to see my code feel free to download the project here (easily importable into Eclipse).
Thankfully the Robocode API, RoboWiki FAQ, general knowledge of Java syntax, and the handful of samples provided by the Robocode installation itself, help in the construction of the robots. Of all the robots created, the most difficult concept was to make the robots move directly to a position using polar style coordinates rather than trying to simplify it to Cartesian movements (concept used in Movement4 -6). It took a bit of remembering trigonometry, a little cross checking with some peers, and a couple of illustrations (half of which look like scribbles) to make it work out in my favor and soon movements aiming towards certain coordinates would out fine. The problem arises because our polar coordinates compass to the up direction and arc tangent finds angles from your position towards the target (which sometimes is angled downwards). When trigonometry was not a factor, the sample robots and the Robocode Wiki was an invaluable resource to getting over difficulty tracking other robots.
Dusting off my coding legs (or fingers would be a more apt choice of words in this situation), I found myself easily sucked into the wonder of writing up code and testing it out, though not always to nice results or nice coding. There were some times when I’d be starring at a robotank spinning around in circles nowhere near its target point. But while spinning party bots may be fun in their own right, the biggest thing for me to remember was to keep at it till it worked just right.
Getting right into the thick of the code and debugging felt like a lost friend, as search through the code waiting for the point where I no longer see the 0 and 1 of the matrix and start seeing what reality it holds. With Robocode the accuracy of numbers really is the key, figuring angles and even the exact coordinates can be difficult using the double type and often times it seems like my robot will fidget trying to get into the exact spot.
As a coding practice tool, I think Robocode works will for those who want to see their code do things graphically, as well as any person with an inner gamer in them that wants to make something to beat something else. It may not be as physically intensive as making robots, but when you can't make them it makes sense to work on how one would think in code. I look forward to playing around and developing more robot ideas as I aim to try to make a tank to throw off my opponent’s ability to predict movement. But the details behind that will be another story for another time.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment