package edu.miamioh.cse283.htw;

import java.util.*;

public class Room {
	public ArrayList<ClientProxy> players;
	private ArrayList<Room> connections;
	private int n;

	public Room(int n) {
		players = new ArrayList<ClientProxy>();
		connections = new ArrayList<Room>();
		this.n = n;
	}

	public void addBidirectionalConnection(Room other) {
		connections.add(other);
		other.connections.add(this);
	}

	public Room[] getConnections() {
		return (Room[]) connections.toArray();
	}

	public int getNumber() {
		return n;
	}

	public void addPlayer(ClientProxy client) {
		players.add(client);
	}

	public void removePlayer(ClientProxy client) {
		for (int i = 0; i < players.size(); i++) {
			if (players.get(i) == client) {
				players.remove(i);
			}
		}
	}
}

@@ -72,16 +72,204 @@
 Room %7B%0D%0A
+%09public final int EMPTY = 0;%0D%0A%09public final int WUMPUS = 1;%0D%0A%09public final int GOLD = 2;%0D%0A%09public final int HOLE = 3;%0D%0A%09public final int BATS = 4;%0D%0A%09public final int OTHER_PLAYERS = 5;%0D%0A%0D%0A
 %09public 
@@ -297,24 +297,24 @@
 %3E players;%0D%0A
-
 %09private Arr
@@ -356,16 +356,40 @@
  int n;%0D
+%0A%09private int contents;%0D
 %0A%0D%0A%09publ
@@ -500,24 +500,45 @@
 his.n = n;%0D%0A
+%09%09contents = EMPTY;%0D%0A
 %09%7D%0D%0A%0D%0A%09publi
@@ -1021,16 +1021,16 @@
 %09%7D%0D%0A
-
 %09%09%7D%0D%0A%09%7D%0D
 %0A%7D%0D%0A
@@ -1025,12 +1025,756 @@
 %09%09%7D%0D%0A%09%7D%0D
+%0A%0D%0A%09public boolean hasSense() %7B%0D%0A%09%09return contents != EMPTY;%0D%0A%09%7D%0D%0A%0D%0A%09public String getSense() %7B%0D%0A%09%09switch (contents) %7B%0D%0A%09%09%09case WUMPUS:%0D%0A%09%09%09%09return %22You smell the smelly smell of a Wumpus%22;%0D%0A%09%09%09case OTHER_PLAYERS:%0D%0A%09%09%09%09return %22You hear another adventurer knocking an arrow%22;%0D%0A%09%09%09case BATS:%0D%0A%09%09%09%09return %22You hear the screech of the bats%22;%0D%0A%09%09%09case HOLE:%0D%0A%09%09%09%09return %22You hear the whistling wind%22;%0D%0A%09%09%09case GOLD:%0D%0A%09%09%09%09return %22You see the shimmering light of gold!%22;%0D%0A%09%09%7D%0D%0A%09%09return %22You see nothing... nothing!%22;%0D%0A%09%7D%0D%0A%0D%0A%09public String%5B%5D getSenses() %7B%0D%0A%09%09ArrayList%3CString%3E senses = new ArrayList%3CString%3E();%0D%0A%09%09for (Room r : connections) %7B%0D%0A%09%09%09if (r.hasSense()) %7B%0D%0A%09%09%09%09senses.add(r.getSense());%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09return (String%5B%5D) senses.toArray();%0D%0A%09%7D%0D
 %0A%7D%0D%0A

add contents to Room