As an exercise in solving algorithmic problems, program Karel to place a single beeper at the center of 1st Street. For example, if Karel starts in the world
it should end with Karel standing on a beeper in the following position:
Continue reading “cs106a – Assignment #1 – Task #4”
In this exercise, your job is to get Karel to create a checkerboard pattern of beepers inside an empty rectangular world, as illustrated in the following before-and-after diagram:
This problem has a nice decomposition structure along with some interesting algorithmic issues. As you think about how you will solve the problem, you should make sure that your solution works with checkerboards that are different in size from the standard 8×8 checkerboard shown in the example. Odd-sized checkerboards are tricky, and you should make sure that your program generates the following pattern in a 5×3 world:
Another special case you need to consider is that of a world which is only one column wide or one row high. The starter folder contains several sample worlds that test these special cases, and you should make sure that your program works for each of them.
Karel has been hired to repair the damage done to the Quad in the 1989 earthquake. In particular, Karel is to repair a set of arches where some of the stones (represented by beepers, of course) are missing from the columns supporting the arches, as follows:
Continue reading “cs106a – Assignment #1 – Task #2”
Your first task is to solve a simple story-problem in Karel’s world. Suppose that Karel has settled into its house, which is the square area in the center of the following diagram:
Prerequisites to the third lecture is reading the chapters 4 to 6 of “Karel the Robot learns Java”. They provide an introduction to top-down design and algorithms.
Prerequisites to the fouth lecture is reading the chapters 1 and 2 of “Art and Science of Java“. The lecture provides a brief history of computer science and describes how the lessons learned from Karel can be translated to Java.
Prerequisites to the fifth lecture is reading chapter 3 of “Art and Science of Java“. The lecture provides an introduction into variables an data types.
Prerequisites to the sixth lecture is reading chapter 4 of “Art and Science of Java“. The lecture further introduction into using variables, their scope and how to combine them, as well as constants and last but not least combining boolean structures.
Code for these lecture as well as the used worlds are available on github.
Prerequisites to the second lecture is reading the chapters 1 to 3 of “Karel the Robot learns Java”.
Karel knows four basic commands (or methods):
move() turnLeft() pickBeeper() putBeeper()
To run feed Karel commands, first import Karels basic commands, create a class derived from Karel and put the commands into a run() method:
Continue reading “cs106a – Lecture #2: Programming & Control Structures”
The first lecture mainly provides administrative details about the course. Two text books are named to be required for the course:
- Karel the Robot Learns Java, which is included in the iTunes stream and
- Roberts, Eric: The Art and Science of Java with slides and code available for free at Stanford.
It also refers to the Stanford Honor Code states:
Rule 3: You must not look at solution sets or program code from other years.
Continue reading “cs106a – Lecture #1: Introduction”