All pastes #951640 Raw Edit

Map

public text v1 · immutable
·published 2008-03-21 15:43 UTC
rendered paste body
package JoeWumpusMapAndPlayer;
import java.util.Random;
/**
 * Summary description for Map.
 */
public class Map
{
	private int playerLocation; //0-29 when communicated to the user, add 1.
	public boolean[] pitLocations;
	public boolean[] batLocations;
	public int wumpusLocation;
	public Cave thisCave;
	public Random gen;
	/**
	 * @param caveNumber the cave's ID number.
	 */
	public Map(int caveNumber)
	{
		gen = new Random();
		thisCave = new Cave(caveNumber);
		//UNFINISHED
	}
	/**
	 * Moves the player
	 * @return if the direction is valid
	 */
	public boolean playerMove(int direction)
	{
		
	}
	/**
	 * Adds a bats to the map
	 */
	public void addBats()
	{
		//implement method
	}
	/**
	 * Adds a pit to the map
	 * NOTE: add a parameter for the rooms pits can't be in.
	 */
	public void addPit()
	{
		//implement method
	}
	public void addWumpus()
	{
		//Adds the wumpus to the map
	}
	/**
	 * Shoots an arrow at location target
	 * @param target the location the arrow is shot at
	 * @return if the wumpus is in the target room
	 */
	public boolean shootArrow(int target)
	{
		return false;
		//implement method
	}
	/**
	 * Move the wumpus
	 */
	public void moveWumpus()
	{
		int[] possibleMoves = thisCave.getConnections(wumpusLocation);
		boolean done = false;
		int target = 7;
		while (!done)
		{
			target = gen.nextInt(6);
			if (possibleMoves[target] >= 0)
			{
				wumpusLocation = possibleMoves[target];
				done = true;
			}
		}
	}
	/**
	 * Make the wumpus run away uyp to two spaces
	 */
	public void runWumpus()
	{
		//UNFINISHED

	}
	/**
	 * @return the  Room information for this location on the map
	 */
	public RoomInfo getRoomInfo(int location)
	{
	}
	/**
	 * Move the player & bats into a new random rooms
	 * @return if there are Bats and a player in the chosen room.
	 */
	public boolean activateBats(int roomNumber)
	{
	}
}