The problem
How to teach the basic principles of programming to a group of around 30 year 9 pupils in under 60 minutes (without them getting bored).
In July 2005, the University of Hull was running an event named "Progression Fest" at its Scarborough campus, which involved year 9 pupils from local schools taking part in specialised sessions held on the campus. Each pupil would attend several different sessions, each run by different departments. The Centre for Internet Computing was to hold ten sessions over two and a half days, with up to 28 pupils attending each session.
Robocode
Robocode is an open source application developed by IBM which can be used to help teach the basic principles of Java, by creating robots which battle one another in a virtual arena.
However, as a teaching tool, it is better suited for a sixth form class; whilst selecting robots and watching them battle is a simple task in the Robocode application, building a robot is still done using a text editor and API documentation for reference.
If the robot code could be created using a graphical "point and click" interface, compiled automatically and linked to the Robocode application, it would allow a younger audience to learn some basic programming concepts in a short time, whilst giving them a rewarding result.
RoboEdit
RoboEdit was a web application designed specifically to run within the Courtyard Computer Laboratory at Hull University's Scarborough campus. This is new lab with 48 PowerMacintosh G5s running (at the time of writing) Mac OS 10.3 (Panther). With running Mac OS X, Apache and Java are built in as standard and PHP can be installed very easily thanks to a double-clickable installler from Marc Liyanage.
RoboEdit was the name given to the client interface which is hosted on each individual client machine. The local versions of Apache, PHP & Java are utilised to run the interface, build and compile the individual robot Java code. Each client must also have a copy of the Robocode application installed, to enable the user to incrementally test their robot (and to enable automatic compilation of the generated Java code).
The behaviour creation interface itself it seperated into certain methods which the user can add commands to; these methods include setColours, run, onScannedRobot, onHitByBullet, onHitWall and onHitRobot. Adding a command to a method is achieved by clicking the command name in the right hand pane; it is then added to the commands list in the centre pane. Commands can be deleted or moved up and down the list; it was considered an important teaching point that sequence, selection and repetition all be represented. Some commands have parameters which are set using a drop-down menu; others require terminating commands and suitable error checking and user feedback is built into the system. Each method must be saved before a different method can be edited. The browser window is not refreshed after each command is edited, only when the method is saved; the system makes use of JavaScript DOM manipulation to achieve this.
Another system, named RoboAdmin, is installed onto one specific machine; this is the machine upon which all the client robots will be gathered together for a battle at the end of a session (and is typically connected to a projector). Each client sends a notification to the admin machine when a user completes the robot creation process; the admin interface must then store certain client details to enable the robot class files to be gathered for the final battle.
A "quick turnaround" was a prerequisite, since only a few minutes were available to reset all client machines between teaching sessions. The client interface has a small pi symbol in the lower right hand corner; this links to an administration section for that client. Three password protected functions were designed:
- A reset command (which returned the machine to a state ready for the next user).
- An anti-tamper mechanism: in the event of a skilled year 9 pupil discovering how to delete cookies from their client (which the interface uses to store user & robot information), the cookies can be fully restored.
- In the unlikely event of the admin notification not being received by RoboAdmin, it can be resent.
Requirements
RoboEdit was developed to solve a specific problem in a specific situation and as such has quite specialised requirements (namely those matching the computer laboratory in which it was designed to run).
- Robocode 1.0.7
- Mac OS 10.3.9 or higher
- Safari 1.2 or higher
- Apache 1.3 or higher
- PHP 4.3.11 or higher
- Java 1.4.2 or higher
Disclaimer
RoboEdit & RoboAdmin were coded in about a week and a half. Although they performed their tasks flawlessly during the "Progression Fest" event, they undoubtly have bugs and are known to have very specific requirements, as noted above.
They are unlikely to kill your machine, but they do issue system commands through PHP when building (compiling) a robot and you are advised to thoroughly check the source code before running any of the interfaces.
Download source code
These downloads are not an instantly deployable system; they are provided as reference source code only.
Do not expect the systems to run if you simply download, decompress and copy into an Apache served directory.
- roboedit.zip (153 KB) (includes RoboEdit & RoboAdmin)