import structure.*; /** * This module includes the functions necessary to keep track of the creatures * in a two-dimensional world. In order for the design to be general, the * interface adopts the following design: *
1. The contents are unspecified objects. *
2. The dimensions of the world array are specified by the client. *
* There are many ways to implement this structure. HINT: look at the * structure.Matrix class. You should need to add no more than about ten lines * of code to this file. */ public class World { /** * This function creates a new world consisting of width columns and height * rows, each of which is numbered beginning at 0. A newly created world * contains no objects. */ public World(int w, int h) { } /** * Returns the height of the world. */ public int height() { Assert.fail("Implement me."); return -1; } /** * Returns the width of the world. */ public int width() { Assert.fail("Implement me."); return -1; } /** * Returns whether pos is in the world or not. @pre pos is a non-null * position. @post returns true if pos is an (x,y) location in the bounds of * the board. */ boolean inRange(Position pos) { Assert.fail("Implement me."); return false; } /** * Set a position on the board to contain c. @pre pos is a non-null position * on the board. */ public void set(Position pos, Object c) { Assert.fail("Implement me."); } /** * Return the contents of a position on the board. @pre pos is a non-null * position on the board. */ public Object get(Position pos) { Assert.fail("Implement me."); return null; } public static void main(String s[]) { /* test everything here ... */ } }