
In order to make things easier, we can write out a list of which directions have walls by giving a list of 4 letters, such as: It doesn't have a map of its environment, so it can't plan ahead to figure out where to go (think about this!) It also can't see very far-only one square to the north, east, south, and west of it.įor example, in the above image, Karol can see a wall to the north and a wall to the west, but sees nothing to the east or south. Note that Karol starts at a random location in the room-you can't assume anything about the initial location! Sensing Surroundingsīut to match it's simple shape, Karol is a very simple robot.

Karol stops automatically when it has completely explored the room, content in a job well done. Each time Karol takes a step, it leaves a gray trail behind it. The walls of the room are blue and the empty area (the floor) is white. Tries to automatically vacuum the entire floor. Karol's job is to search every inch of its environment-the exact same way a It may not look like much, but Karol (see below) is a robot. You will not need any additional files for this lab. Note that you will need to use the Chrome or Firefox browser to program Karol. Here is a link to the online Karol simulation (new window).

Note that this lab (and all subsequent labs) will be completed in pairs. It will also give you a chance to practice submitting your work (in this case, the set of instructions for the robot) electronically. This will give you a chance to practice thinking like a computer scientist: how we can write specific instructions in a very specific format in order to solve a problem. The challenge is that Karol is very near-sighted, so you will only be able to use local sensing, so instructions need to be based only on what is nearby. You will program a simple "robot" named Karol with a mission to completely explore its environment-no matter what the environment looks like. In this lab you will do your first piece of programming. CS 161 Lab A - Karol the Robot Due Fri Sep 06 at 9:00am Overview
