Karel the Robot was created in the 70s by Rich Pattis. It/he was designed to help beginners learn how to program without all the additional complexities that programming languages bring. By cutting back to basics, it allows the simple things to be learned first such as the structure of programming as well as the preciseness of coding.
I mentioned in my CS106A lecture notes that Karel lives in a grid and has a few limited capabilities such as being able to move forwards, turn left and carry a bag of beepers as well as pick beepers up and put them down. He can also not pass through walls. His little world doesn’t necessarily need to be little and can be custom built to whatever size and have various walls put around the world.
Karel the Robot now runs in Java and works in the Eclipse development environment which makes it handy for when you move later on in CS106A to a regular version of Java.
As Karel starts you off on a simple introduction, it allows you to learn how to extend the capabilities of the robot and make it do more advanced things. The whole language used to command Karel is basic enough to learn within a couple of lectures but it has been created in a way to make you easily move on to Java. As mentioned, the language of Karel is easy enough to learn. What makes Karel more difficult is the problems that you need to solve.
Four Basic Karel Commands
When you are first introduced to Karel, he responds to four basic commands:
move() – Moves Karel 1 space in the direction he is facing
turnLeft() – Turns Karel 90 degrees anti-clockwise
pickBeeper() – Picks up a beeper if present
putBeeper() – Puts down a beeper if there is one in his beeper bag
By using these four commands, you can navigate Karel around his world. You might ask why there is no turnRight(). At the beginning of the course, Karel is limited. To turn right, you’ll just need to pass three commands of turnLeft() to him which will then put him in the direction you want to go in.
Learning About Objects and Classes
Karel the Robot is also an introduction to the world of object-oriented programming. As I don’t fully grasp the concept of object-orientated programming yet, I wont try explain it in detail here. A simple summary can be found in the Karel the Robot book. As the course goes on, there is more about the object-orientated approach that you will need to learn and understand before advancing further with programming (noting that in the beginning, you might be just accepting things as they are until you get a full grasp).
Learn by Doing
Although you can learn a lot from text books, online lectures and will probably find that you quickly understand the sample code used, you will also find that it is very difficult to think up code for yourself. This is why it is important to complete the assignments as well as other requirements of the course… without cheating… as it will give you more experience and help you to learn to think and code for yourself.
The first reading prior to lecture 2 on CS106A is the first 3 chapters of Karel the Robot. I suggest you read and study the text so that you are prepared for the lecture and have more understanding of what you will be required to do.
Kazektines Bavlor says
Great article! I’m currently taking up I.T.
Reading this helps me understand easier about Karel. I’ve yet to check out your lectures too!