[Robot]
  Karel the Robot  

Comparison of Solutions


Comparison of Harvest Field task programs.


Discussion of Program 1

This program is correct and works (after the dots are filled in, of course). However, it is very difficult to take a quick look at the program and decide what it is doing. It is unreadable.

It is easy to forget one of the instructions, in which case the whole program would either lead to an error shutoff or to an unexpected intent error. However, it would be difficult to find the missing (or superfluous) instruction. It is hard to debug.

If, say, another row of beepers grows overnight, this program would need a whole slew of new instructions. It is difficult to extend.


Discussion of Program 2

After filling in the definitions for the new words, this program will not necessarily be shorter than program 1. However, it seems easy to see what is going on, even if you are not an expert in robot programming. It is easy to read.

If one of the instructions does not work, we can concentrate on fixing it. Once it is fixed, it will continue to work correctly at every point where it is used. Therefore, the program is easy to debug.

If, say, another pair of rows of beepers grows overnight, this program could very easily be modified. Just add a couple of lines and those rows will be harvested as well. It is easy to extend.


[MTSU]  | CS  | [Home] Return to Karel home page
(Credits and Copyrights)