World MAP

The environments that will be simulated in this project are two-dimensional ``gridworlds''. A gridworld is just a set of $ \LR{x,y}$ coordinates arranged on a rectangular grid - essentially, the integer grid points on a 2-d Cartesian plane. Unlike a Cartesian plane, however, the world here can have different topologies to describe different environments. For example, the system might model worlds that are bounded 2-d rectangles, infinite grids, torii, spheres, or many other more complex topologies.

The WORLD SIMULATOR employs an internal object of type GridWorld2d<T>to store its representation of the world MAP. A concrete implementation of GridWorld2d<T>will implement a specific topology, and an instance of that concrete class will have specific dimensions. For example, a RectangleGridWorld2d<T> represents all possible bounded rectangular gridworlds, while

    GridWorld2d<T> gwInst=new RectangularGridWorld2d<T>(20,30);
would be a bounded rectangular gridworld that is 20 units wide in the $ x$ direction and 30 units high in the $ y$ direction. An example of a RectangularGridWorld2d<T>(10,10) is shown in Figure [*].

Figure: Example of a RectangularGridWorld2d<T> environment instantiated with Indoor terrain types (Section [*]). This environment is $ 10\Cross 10$, the AGENT's LOCATION is $ \LR{x=4,y=4}$, and the AGENT's ORIENTATION is West (where $ x$ is read horizontally, starting at 0, and $ y$ is read vertically from 0). The white cells denote Floortiles and the gray cells denote Wall tiles. Note that the AGENT is not part of the gridworld; it is pictured only for reference.
[width=0.5]pics/indoor_maze

In order to support a wide variety of different MAP types, including different terrain/obstacle types, GridWorld2d<T>is a Java generic. The type parameter, T, is filled in to instantiate the GridWorld2d<T>for a specific application. For the JRoboExplorerproject, the GridWorld2d<T>will be instantiated with different terrain/obstacle types.

For Milestone 2 (Section [*]), the designer MUST provide two different GridWorld2d<T>implementations; for extra credit, a third can be implemented as well:

RectangularGridWorld2d<T>
A bounded, rectangular grid. The grid is initialized to a fixed range in $ x$ and $ y$ and the agent can never leave the rectangle contained within that range. The $ x$ and $ y$ ranges MAY be arbitrary, or the designer MAY constrain the ranges to begin at 0 so that the entire RectangularGridWorld2d<T falls within the first quadrant of the Cartesian plane.
TorusGridWorld2d<T>
A grid covering a regular torus with a fixed $ x$ and $ y$ radius. A torus is equivalent to a rectangle except that when the AGENT moves off one side, it enters on the opposite side. For example, if the AGENT is located at maxY() and it moves in the $ +y$ direction, it moves to minY().
InfiniteGridWorld2d<T>
(OPTIONAL) A grid tiling an ``infinite'' plane. An AGENT in a MAP of this type can move unboundedly far in any direction. Note: an implementation of this type MUST only consume space proportional to the number of LOCATIONs that the AGENT actually touches. It MUST NOT attempt to pre-allocate an infinitely large array. (Obviously.)

Terran Lane 2005-09-29