/**
 * Turns the user's intentions into game operations and reports refusals. No
 * JavaFX imports: it is tested with a fake view.
 */
public class KlondikeController {
	private KlondikeGame game_;
	private KlondikeView view_;

	public KlondikeController ( KlondikeGame game, KlondikeView view ) {
		game_ = game;
		view_ = view;
	}

	public void drawFromStock () {
		view_.showMessage("");
		game_.drawFromStock();
	}

	/**
	 * Plays the waste card to a column (0-based); returns whether the game
	 * accepted it.
	 */
	public boolean playWasteTo ( int column ) {
		boolean moved = game_.moveWasteTo(column);
		if ( moved ) {
			view_.showMessage("");
		} else {
			view_.showMessage(game_.getLastError());
		}
		return moved;
	}
}
