package net.woodyfolsom.msproj.policy;

import java.util.Collection;

import net.woodyfolsom.msproj.Action;
import net.woodyfolsom.msproj.GameConfig;
import net.woodyfolsom.msproj.GameState;
import net.woodyfolsom.msproj.Player;
import net.woodyfolsom.msproj.gui.Goban;

public class HumanGuiInput implements Policy {
	private Goban goban;
	
	public HumanGuiInput(Goban goban) {
		this.goban = goban;
	}
	
	@Override
	public Action getAction(GameConfig gameConfig, GameState gameState,
			Player player) {
		Action action = null;

		do {
				System.out.println(player
						+ " to move: (Use GUI)");
				
				goban.setGameState(gameState);
				action = goban.getAction();

				if (action.isNone()) {
					continue;
				}
		} while (action == null);

		return action;
	}

	@Override
	public Action getAction(GameConfig gameConfig, GameState gameState,
			Collection<Action> prohibitedActions, Player player) {
		throw new UnsupportedOperationException("Not implemented");
	}

	@Override
	public int getNumStateEvaluations() {
		// TODO Auto-generated method stub
		return 1;
	}

	@Override
	public void setState(GameState gameState) {
		goban.setGameState(gameState);
	}

}
