Pick one of the following problems to do for your interclass problem.

1. Endless sidewalk (wrap around) - Generate 5 people, and have them randomly walk around. Write code that moves a person from one end of a row or column to the other if the person tries to walk off-screen. Use getWidth() and getHeight() to determine the size of the screen.

2. Making an entrance - Generate 5 people and 3 buildings. Have the people randomly walk around and detect whether or not a person has encountered a building. If so, enter the building (remove the Person from the board).

3. Under construction - Generate 6 people and have them walk around randomly. Whenever two or more people enter the same location, a building is constructed there, provided one doesn't exist at that location.

4. Avoidance detection - Randomly generate 5 people and 5 buildings on the map. Have the people randomly move, but never into the same cell as buildings or other people.

Options 2-4 all require that you have the ability to tell if something is at a particular location in the city. We haven't learned how to do this yet so I'm providing the code for it here. These two methods could be put in a class that inherits from Actor to get the type of functionality that you would expect based on their names. Because of the way that Greenfoot works, you won't get the results you expect unless you either use a smaller image of the building or make the cell size in City 80 or larger. I change the first line of the construtor in City to be super(10,10,80); and get the right behavior in my testing.

    public boolean isPersonAt(int x,int y) {
        return !getWorld().getObjectsAt(x,y,Person.class).isEmpty();
    }
    
    public boolean isAnotherPersonAt(int x,int y) {
        return getWorld().getObjectsAt(x,y,Person.class).size()>1;
    }
    
    public boolean isBuildingAt(int x,int y) {
        return !getWorld().getObjectsAt(x,y,Building.class).isEmpty();
    }