Masters of Java

05 Dec, 2005
Xebia Background Header Wave

MoJPicture this: a dimly-lit basement-like room filled with PCs, a large projection screen showing the current standings and 30 teams of 2 people each hunched over a computer. Although just as hectic, this is not a multiplayer game of Quake or Doom, but rather the Masters of Java programming contest.
The contest runs for a whole day, with each team competing in 5 tasks (out of 6, each team was assigned one task they would not be competing in). Each task contains one or more Java source files, with one class or method still to be implemented. The client software (an applet) behaves as an IDE (though no handy Javadoc lookup or code completion) and is used to compile the code, run the testcases and submit the results.
Our team (named Inspiring 42 after a counting mishap 🙂 ) participated for the first time. Although we did have experience in other programming contests, the MoJ format was new to us: the realtime program/compile/test cycle, the short timeline for each task (30 minutes) and the large visible clock (and accompanying sound effects, like the crash of a gong at the start of the round and an annoying bleep-bleep sound when another team submits a solution).
The organizers published a preview of the cases on the MoJ site days before the event. That a lot of the contestants had looked at these and guessed what the tasks might be showed during the first assignment (validating Sudoku puzzles). Solutions for the Sudoku problem were entered very quickly. We had also done our homework and managed to be the first competing team to succesfully submit a solution.
For the second task we had to implement a simple load-balancing algorithm. Again, we finished first. Everything was looking good and the main price (a SUN Opteron workstation) was almost ours!
The third task had to do with regular expressions and this was really tough for us. At the end of the alotted 30 minutes we still had not found the correct regular expressions to solve this problem. Funny enough, neither had the winning team — they solved the problem by creating an anonymous inner class that parsed the input using a StringTokenizer. Hardly what the organizers had in mind, but it worked and earned them 20 points. I just wish we had thought of it! 🙂
Obviously, this debacle caused us to drop to the number two spot. Worse, the team in the #3 position did not compete in the first task, so they could pass us if they performed well in the task we would not compete in. This was the fifth task: performing MD5 hash calculations to find suspect employees. We did well (finishing first again) but that did not score us any points since we weren’t competing. So now we were in the #3 position.
The last official assignment, AaiRobot, was a funny one. The idea was to guide a robot through a maze to it’s home location. There was very little information to go on, though, only a bump sensor, light sensor (to sense the color of the tile the robot was on) and a test to see whether or not this was the destination square. There was no indication of how far the robot was from the final square.
Also, the last test case required the robot to walk along a corridor and, halfway through, turn left without any indication. After attempting to come up with a generic algorithm, we realized a different approach was needed and, using trial and error, we determined the exact location at which to turn left (using the total distance travelled by the robot) that worked for the test case and submitted the result.
Even though we gave it our best shot we never recovered from the regexp task. The robot-task was a weird one and I’m not sure I like it. In the end, we did not submit a correct algorithm but a program that manages to complete the testcases. A small change such as moving the destination square in the final test case left by one square will break our “solution”.
All in all, the contest was a great experience and a lot of fun. We’ll be sure to participate again next year. And you better believe we will have studied up on regular expressions by then! 😉
Team Inspiring 42 a.k.a. Erik Rozendaal / Martin van Vliet


Get in touch with us to learn more about the subject and related solutions

Explore related posts