Archive | Karel The Robot RSS feed for this section

Karel Defends Democracy Assignment And Solution

30 Oct

So if you were able to complete all the Assignment 1 problems, this one shouldn’t really take you that long. Here is the assignment:

This assignment is presented during the student Section, so there is no zip file for it to download. However, it is not that difficult to set this up yourself. To get started, click the green “C” button and create a class called “defendDemocracyKarel”. Now you can start a file with the following commands:

import stanford.karel.SuperKarel;

public class defendDemocracyKarel extends SuperKarel {

public void run() {

You also need to create a new world, as is shown in the assignment. Simply load Karel, and it’s pretty simple to create new worlds.

Here is my solution (although the solution is also available on the assignment site)

Continue reading

Stanford CS106A Lecture 3

28 Oct

Haha… I should have watched this Lecture before completing the first assignment (at least for the last two problems from it)!

Here are my takeaways from this Lesson, which I wish I would have applied earlier:

Continue reading

CheckerboardKarel Solution

27 Oct

Wow, this one is tough. I gotta be honest, this took me days to figure out. There was a lot of trial and error, and I started from scratch a couple times when I started getting lost in the code. Here is the problem:

Here is my solution:

Continue reading

MidpointFindingKarel Solution

25 Oct

Wow! This one took me a few hours to figure out, and I even had to look for help to get me started. Things I learned in the process:

  1. Write down the solution in normal words before getting started with the code.
  2. Run the program often to make sure it matches your expectations
Here is the MidpointFindingKarel Problem:

Here is my solution:

Continue reading

StoneMasonKarel Solution

22 Oct

So the second assignment is a bit harder and requires some “while” and “if” logic. Here is the problem:

Here is my solution:

Continue reading

CollectNewspaperKarel Solution

22 Oct

This lecture explains how to get started with Karel the Robot:

After watching the lecture, there are a few assignments to get you started. The first one is pretty simple and gets you to feel comfortable with the basics:

Here is my solution:

Continue reading

Hello world!

22 Oct

I finally decided to learn to program. After checking out a bunch of available resources, I’ve decided to go through the Stanford School of Engineering amazing Introduction to Computer Science class. So far, I am extremely impressed with the class, mostly because it includes lectures, handouts, assignments, tests, everything!

And unlike some of the other classes I’ve taken, it doesn’t begin by putting in 1+1 into a terminal. It starts by teaching you a simple “Karel the Robot” program, in which you get a robot to walk around in a grid and drop diamonds named Beepers. It is very concrete and fun for a first time programmer.

However, I do need some support, so I’m starting this blog to keep me motivated through all the hard programming problems.