All pastes #964834 Raw Edit

Room

public java v1 · immutable
#964834 ·published 2008-03-31 16:19 UTC
rendered paste body
package Wumpus;/** * A room which holds room number and room connections */public class Room{	// The room number. a number from 0 to 29.	private int roomNum;	// Array of the room connections.	// -1 represents a wall, integer corresponds to the connecting room	// Elements ordered starting at north and moving clockwise around the compass.	private int[] connectingRooms;	// A boolean stating whether a pit can be placed in the room	private boolean canPlacePit;		public Room()	{		roomNum = 0;		connectingRooms = new int[6];		canPlacePit = true;	}	/**	 * @param roomNum The room number	 * @param connections The rooms or walls in each direction	 */	public Room(int aRoomNum, int[] connections, boolean canHavePit)	{		roomNum = aRoomNum;		connectingRooms = connections;		canPlacePit = canHavePit;	}	/**	 * @return The current room number	 */	public int getRoomNum()	{		return roomNum;	}	/**	 * @return An array with the connection types according to a clockwise direction change starting at north. Null is wall, otherwise number corresponds to room	 * 	 */	public int[] getConnections()	{		return connectingRooms;	}	/**	 * @return A boolean of whether the room can have a pit placed in it	 */	public boolean canHavePit()	{		return canPlacePit;	}}