Ice01 PART 2: City Setup

Note:  Please keep the programs that you create today, in case you have a question about your grades for the ICEs at the end of the quarter. When you're working with a partner, each person should save his-or-her own copy.

 

ICE ICE 2.2: Setting Up the City

The following ICE was designed for you to get comfortable setting up a City.

ICE ICE 2.2.1: The Basics

Start by using the computer to make a simple city with nothing in it. You should start with Starting_Template.java with the line numbers turned on (using the line number icon in the menu bar), then delete lines 24 and 25, and 38 and 39, and try and write all the code yourself from memory as outlined below (if you can't remember how to do everything from memory, then go ahead and peek at the java code online by double-clicking on the link to get an idea).

Write code to create a City named seattle (remember that Java is case sensitive!), and within seattle, create a new robot named seahawk.

Put seahawk on street 2 and avenue 3 and have him facing EAST and with nothing in its bagback, although if you wanted to you could have thr robot start with some things already in its backback (e.g, 10 or 100).

ICE ICE 2.2.2: Some Walls

Use the code that you've created in ICE 2.2.1 as a basis for doing this part.

First, examine the picture (below), and figure out which intersection the robot and the thing are located at.

Next, figure out how many walls there are, and which intersection they're at, then figure out the street/avenue/directional logic needed to set up the walls in the code to make a four-sided box.

HINT: Look at the comments in the Starting_Template.java file for hints on how to set up Walls and Things.

You should then try to write out the Java code that will generate the city as shown below.

Use the file that you created for ICE 2.2.1 above as a starting point, modifying it as needed, beginning by changing the street and avenue numbers in order to start the robot on the street and avenue shown.

City

ICE ICE 2.2.3: Hi (OPTIONAL)

If you finish ICE 2.2.2 and still have time, try creating the city pictured below in another java file.

Hi

Remember: if you copy and rename a file, you also have to rename the class that holds the main() method to match. For example, if you make a copy of the Starting_Template.java file and rename it to hello.java, then the class name has to be named hello as well (without the .java extension), so it might look like this:

public class hello extends Object