Welcome to Robocode
If you've never heard of Robocode and you are learning Java or C#, I would recommend using it as a means to build your programming chops. To my great satisfaction, it's like Logo with guns. Instead of a turtle, you have a tank. It's an action game in which the your control is exercised only before the action begins, e.g. a programming game. The goal is to use the Robocode API to code a clever robot to beat the other bots in the arena, when they face off at runtime.
There's an entry on the Wikipedia that provides a bit more background and description of the game's mechanics.
Can I Math?
As I strive to become more mathematically sophisticated, I was not disappointed to find myself going back to basics, to relearn things like the unit circle and radian arithmetic. It's been twelve years since I last practiced trigonometry, and it was pleasantly surprising to find my competencies were not entirely lost. I managed to complete all of the code katas (exercises in form) with which I had been tasked, though my implementations were not always perfectly elegant.
Relearning long-forgotten trigonometric functions was the brainiest part of the work. Along the way, I gained a fair understanding of the nuances of the game. Virtually all the sample code I saw was for the AdvancedRobot class, which provides many additional abilities for the robots that use it. Using AdvancedRobot is verboten for my katas, though, as allowing it would encourage me to cut and paste other people's code into the project, bypassing the learning process.
Incidentally, I couldn't find a way to make my robot turn and move forwards or backwards at the same time. For that reason, the robot that should move on a circular path moves on an icosagonal (20-sided) path instead. If you know of a better way that doesn't use the AdvancedRobot class, please leave a comment and let me know. I feel like I might have missed it, somewhere.
We Each Must Develop a Personal Culture of Practice
Katas of all kinds work for exactly this reason: to perform them, one is forced to learn something new. Ideally, the kata puts the learner into the "reach" zone, where his or her existing skills are fully used, and where something not too difficult, but also not too simple, is to be learned. What is to be learned must be challenging, but not challenging beyond reasonable expectation. Performing the kata is a demonstration of the successful acquisition of the skills requisite for its performance. As such, kata practice is an excellent way to set goals, and to measure one's skills and progression, programmer's skills included.
Having completed only a dozen or so of these Robocode katas, I can assure you that my robots are still very clunky and simple-minded. However, I feel certain that if I were to lay out another couple dozen, I would be making considerable process. I plan to approach the forthcoming robocode competition that way. It's possible that the robots coded after twenty or so katas more would be somewhat of a threat in the arena.
In the end, the robot's behavior is a function of the programmer's behavior; it's performance is a function of the programmer's performance. To perform well, we each must develop a personal culture of practice. The way to mastering our crafts need not be much more complicated than that.
No comments:
Post a Comment