interface Directions { //global Constants static final int north = 0, east = 1, south = 2, west = 3; } // ------------------------------------------------------------ class MapSite { void Enter() {/* ... */}; } // ------------------------------------------------------------ class Room extends MapSite { private MapSite[] sides = new MapSite[4]; private int roomNo; Room(int roomNo) { this.roomNo = roomNo; } MapSite GetSide(int direction) {/* ... for now: */ return null;}; void SetSide(int direction, MapSite ms) { sides[direction] = ms; }; } // ------------------------------------------------------------ class DoorWall extends MapSite { private Room r1; private Room r2; private boolean isOpen; DoorWall(Room r1, Room r2) { this.r1 = r1; this.r2 = r2; this.isOpen = false; }; Room OtherSideFrom(Room r) {return null; /* for now */}; } // ------------------------------------------------------------ class Maze { void AddRoom(Room r) {}; Room RoomNo(int r) {return null;}; } // ------------------------------------------------------------ class Wall extends MapSite { } class MazeGame implements /* uses */ Directions { public static void main(String[] argv) { CreateMaze(); } static Maze CreateMaze() { Maze aMaze = new Maze(); Room r1 = new Room(1); Room r2 = new Room(2); DoorWall d = new DoorWall(r1, r2); aMaze.AddRoom(r1); aMaze.AddRoom(r2); r1.SetSide(north, new Wall()); r1.SetSide(east, d); r1.SetSide(south, new Wall()); r1.SetSide(west, new Wall()); r2.SetSide(north, new Wall()); r2.SetSide(east, new Wall()); r2.SetSide(south, new Wall()); r2.SetSide(west, d); return aMaze; } }