Fetch the Newspaper

6 points

Introduction
Help Karel the Robot to get out of bed, fetch the newspaper that is sitting on the sidewalk in front of his house, and go back to bed to read the newspaper. Before you can do any programming to enable Karel to do this, you'll first need to create a world that includes Karel's house and the newspaper.

 

Creating a World
What is a world? Well, here is a screenshot of a world file I created that includes Karel's house and the newspaper on the front sidewalk. The image also shows Karel asleep in his bed, although the robot is not really a part of the 'world'.

To create a world, download KarelJRobot.jar to your server space ("Documents" folder). Double-click on KarelJRobot.jar to open the World Builder. To create a vertical wall segment, click on 'Vertical Wall' and click in the world where you want to wall to be. To create a horizontal wall segment, click on 'Horizontal Wall'. To add a beeper, click on 'Beeper'.

To delete a wall segment, CTRL-Click on the wall segment. To delete a beeper, CTRL-Click on the beeper.

(More information is available on creating worlds on the creator's web page at csis.pace.edu/~bergin/KarelJava2ed/karelexperimental.html. Scroll down to the section "How to Build a World".)

Once you've got Karel's house built, and the newspaper on the front sidewalk, save the world file to your server space. Any extension, including .kwld, is optional.

 

Fetching the Newspaper
You'll want to use these methods in getting Karel to walk to his newspaper, pick up the paper and return to bed:

Download the file listed below under 'Starting Point' and add your commands to that file.

 

Starting Point

You can download GetThePaper.java to use as a starting point in writing your program.

To import KarelJRobot.jar into:
1. Visual Studio project
You can start the video at 1:15 for this info.

2. IntelliJ project
Go to Project Structure. Go to Modules. Click + to add a new module, and browse to your JAR file.