package net.woodyfolsom.msproj.sgf;

public class SGFResult {
	private boolean resignation = false;
	private boolean tie;
	private double score;
	private SGFPlayer winner;
	
	public SGFResult(String value) {
		String[] params = value.split("\\+");
		
		winner = SGFPlayer.getInstance(params[0]);
		
		if ("R".equals(params[1])) {
			resignation = true;
		} else {
			score = Double.parseDouble(params[1]);
		}
	}
	
	@Override
	public String toString() {
		if (resignation == false && tie == false) {
			return winner.toString() + "+" + score;
		} else if (resignation == true && tie == false) {
			return winner.toString() + "+R";
	    } else {
			throw new UnsupportedOperationException("Not implemented");
		}
	}
}
