Shortcuts With Karel The Robot

Looking for shortcuts in the programming assignments for Karel the Robot taking Stanford’s CS106A online. The instructor knows Karel doesn’t have full functionality of the Java language but a good portion of them. They also intentionally offer two versions of the class: Karel and SuperKarel. I’ll jump ahead.

The class and instructor move as quickly as possible through the material, so sometimes there are things which should be forgiven. In my case, I came to the class having some experience almost twenty years ago programming Java and I can’t help but remember what I learned. In the instructor’s case, there is one small error I noticed that flies by and no one seems to catch it.

It doesn’t matter either way, as long as I get the value from the class material I’m going through in order to better prepare my capability to take Sidecar 2.0 to the next level. Karel the Robot doesn’t turn around, or turn right in order to teach us to program those methods. In the case of the instructor teaching us to program a method for turning left three times for turn right, he said 6 lefts turns would do the same thing.

That’s not true. It would take seven left turns for Karel to have rotated to the effect of ultimately turning right. No big deal right? Well when I was going through to complete the code assignments for class, I realized after looking at the solutions that I was cheating with Karel the Robot. After a class where I was reminded how to use the ‘for’ loop for counting, I used it for assignments that involved counting.

When the class solutions were revealed, often I realized that I missed the concept of the instruction by way of my cheating using counting. For example, I was to drop a ‘beeper’ in the middle of a street. I simply counted steps to the end of the street using a ‘for’ loop for the move() method, divided by two, turned around and used the count variable to walk halfway back, dropping the beeper. If only I could do that with my taxes 🙂

Author: Disa Johnson

Independent consultant in technology, security, and computer programming including website and app development.

Leave a Reply

Your email address will not be published. Required fields are marked *