package net.woodyfolsom.msproj;

public class Player {
	public static final Player BLACK = new Player("BLACK",
			GameBoard.BLACK_STONE);
	public static final Player NONE = new Player("NONE",
			GameBoard.EMPTY_INTERSECTION);
	public static final Player WHITE = new Player("WHITE",
			GameBoard.WHITE_STONE);

	private char stoneSymbol;
	private String name;

	private Player(String name, char stoneSymbol) {
		this.name = name;
		this.stoneSymbol = stoneSymbol;
	}

	public static Player getInstance(String stoneSymbol) {
		if ("b".equals(stoneSymbol)) {
			return Player.BLACK;
		} else if ("w".equals(stoneSymbol)) {
			return Player.WHITE;
		} else {
			return Player.NONE;
		}
	}

	public char getStoneSymbol() {
		return stoneSymbol;
	}

	public boolean isNone() {
		return "NONE".equals(name);
	}

	@Override
	public String toString() {
		return name;
	}
}