// Path: core/src/nkarasch/chessgdx/GameCore.java
// public class GameCore implements ApplicationListener {
// 
// 	public static final String TITLE = "ChessGDX";
// 
// 	private Camera mCameraController;
// 	private ChessLogicController mLogicController;
// 	private BoardController mBoardController;
// 	private PerspectiveRenderer mPerspectiveRenderer;
// 	private OverlayRenderer mOverlayRenderer;
// 
// 	private static Runnable rebootHook;
// 
// 	/**
// 	 * @param rebootHook
// 	 *            game restart hook
// 	 */
// 	public GameCore(final Runnable rebootHook) {
// 		GameCore.rebootHook = rebootHook;
// 	}
// 
// 	@Override
// 	public void create() {
// 		GraphicsSettings.setGraphics();
// 		mCameraController = new Camera();
// 		mOverlayRenderer = new OverlayRenderer(this);
// 		mLogicController = new ChessLogicController(mOverlayRenderer);
// 		mBoardController = new BoardController(mCameraController, mLogicController, mOverlayRenderer);
// 		mPerspectiveRenderer = new PerspectiveRenderer(mCameraController, mBoardController, mLogicController.getPlacement());
// 
// 		Gdx.input.setInputProcessor(new InputMultiplexer(mOverlayRenderer, mBoardController, mCameraController.getOrbitController()));
// 	}
// 
// 	@Override
// 	public void render() {
// 		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
// 		mCameraController.update();
// 		mPerspectiveRenderer.render();
// 		mOverlayRenderer.render();
// 	}
// 
// 	@Override
// 	public void resize(int width, int height) {
// 		// requiring restart on resize instead, this would be tedious to set up
// 	}
// 
// 	@Override
// 	public void pause() {
// 		// not supporting mobile
// 	}
// 
// 	@Override
// 	public void resume() {
// 		// not supporting mobile
// 	}
// 
// 	@Override
// 	public void dispose() {
// 		AssetHandler.getInstance().dispose();
// 		mLogicController.dispose();
// 		mOverlayRenderer.dispose();
// 	}
// 
// 	/**
// 	 * Restarts game client
// 	 */
// 	public static void restart() {
// 		Gdx.app.postRunnable(GameCore.rebootHook);
// 	}
// 
// 	/**
// 	 * Restores board back to the new game state
// 	 * 
// 	 * @param isWhite
// 	 *            player color
// 	 */
// 	public void newGame(boolean isWhite) {
// 		mBoardController.setPlayerColor(isWhite);
// 		mBoardController.resetList();
// 		mLogicController.resetPosition();
// 		mOverlayRenderer.getCheckmateDialog().setState(false, false);
// 		mOverlayRenderer.getMoveHistory().resetHistory();
// 	}
// }
// 
// Path: core/src/nkarasch/chessgdx/view/renderers/OverlayRenderer.java
// public class OverlayRenderer extends Stage {
// 
// 	private final Skin mSkin;
// 	private final PromotionTable mPromotionDialog;
// 	private final CheckMateTable mCheckmateDialog;
// 	private final EngineThinkingImage mEngineThinking;
// 	private final SlidingMenuGroup mSlidingMenu;
// 
// 	/**
// 	 * Foundation of the Scene2D based GUI.
// 	 *
// 	 * @param core
// 	 *            root of game, is passed in so GUI elements can trigger
// 	 *            {@link GameCore#restart()} and
// 	 *            {@link GameCore#newGame(boolean)}
// 	 */
// 	public OverlayRenderer(GameCore core) {
// 
// 		mSkin = new MenuSkin();
// 		ExitConfirmTable exitConfirm = new ExitConfirmTable(mSkin);
// 		SettingsMenuGroup settings = new SettingsMenuGroup(mSkin);
// 		mSlidingMenu = new SlidingMenuGroup(mSkin, exitConfirm, settings, core);
// 		mEngineThinking = new EngineThinkingImage(mSkin);
// 		mPromotionDialog = new PromotionTable(mSkin);
// 		mCheckmateDialog = new CheckMateTable(mSkin);
// 
// 		addActor(mPromotionDialog);
// 		addActor(mCheckmateDialog);
// 		addActor(settings);
// 		addActor(mSlidingMenu);
// 		addActor(mEngineThinking);
// 		addActor(exitConfirm);
// 	}
// 
// 	public void render() {
// 		act(Gdx.graphics.getDeltaTime());
// 		draw();
// 	}
// 
// 	public void dispose() {
// 		mSkin.dispose();
// 		super.dispose();
// 	}
// 
// 	/**
// 	 * @return UI element displaying the move history for both black and white
// 	 */
// 	public MoveHistoryTable getMoveHistory() {
// 		return mSlidingMenu.getMoveHistory();
// 	}
// 
// 	/**
// 	 * @return UI element for letting the user which piece they want to promote
// 	 *         their pawns to
// 	 */
// 	public PromotionTable getPromotionDialog() {
// 		return mPromotionDialog;
// 	}
// 
// 	/**
// 	 * 
// 	 * @return UI element informing the user when the board is in a check or
// 	 *         checkmate state
// 	 */
// 	public CheckMateTable getCheckmateDialog() {
// 		return mCheckmateDialog;
// 	}
// 
// 	/**
// 	 * @return Icon in the bottom left of the screen that rotates when the
// 	 *         engine is in the process of finding a move
// 	 */
// 	public EngineThinkingImage getEngineThinkingImage() {
// 		return mEngineThinking;
// 	}
// }


import nkarasch.chessgdx.GameCore;
import nkarasch.chessgdx.view.renderers.OverlayRenderer;
import chesspresso.Chess;
import chesspresso.move.IllegalMoveException;
import chesspresso.move.Move;
import chesspresso.position.Position;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
package nkarasch.chessgdx.logiccontroller.backend;



public class ChessLogicController {

	private final ObjectMap<Integer, Array<Short>> mLegalMoveMap;
	private final UCIEngineInterface mUCIInterface;
	private Position mPosition;
// Path: core/src/nkarasch/chessgdx/GameCore.java
// public class GameCore implements ApplicationListener {
// 
// 	public static final String TITLE = "ChessGDX";
// 
// 	private Camera mCameraController;
// 	private ChessLogicController mLogicController;
// 	private BoardController mBoardController;
// 	private PerspectiveRenderer mPerspectiveRenderer;
// 	private OverlayRenderer mOverlayRenderer;
// 
// 	private static Runnable rebootHook;
// 
// 	/**
// 	 * @param rebootHook
// 	 *            game restart hook
// 	 */
// 	public GameCore(final Runnable rebootHook) {
// 		GameCore.rebootHook = rebootHook;
// 	}
// 
// 	@Override
// 	public void create() {
// 		GraphicsSettings.setGraphics();
// 		mCameraController = new Camera();
// 		mOverlayRenderer = new OverlayRenderer(this);
// 		mLogicController = new ChessLogicController(mOverlayRenderer);
// 		mBoardController = new BoardController(mCameraController, mLogicController, mOverlayRenderer);
// 		mPerspectiveRenderer = new PerspectiveRenderer(mCameraController, mBoardController, mLogicController.getPlacement());
// 
// 		Gdx.input.setInputProcessor(new InputMultiplexer(mOverlayRenderer, mBoardController, mCameraController.getOrbitController()));
// 	}
// 
// 	@Override
// 	public void render() {
// 		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
// 		mCameraController.update();
// 		mPerspectiveRenderer.render();
// 		mOverlayRenderer.render();
// 	}
// 
// 	@Override
// 	public void resize(int width, int height) {
// 		// requiring restart on resize instead, this would be tedious to set up
// 	}
// 
// 	@Override
// 	public void pause() {
// 		// not supporting mobile
// 	}
// 
// 	@Override
// 	public void resume() {
// 		// not supporting mobile
// 	}
// 
// 	@Override
// 	public void dispose() {
// 		AssetHandler.getInstance().dispose();
// 		mLogicController.dispose();
// 		mOverlayRenderer.dispose();
// 	}
// 
// 	/**
// 	 * Restarts game client
// 	 */
// 	public static void restart() {
// 		Gdx.app.postRunnable(GameCore.rebootHook);
// 	}
// 
// 	/**
// 	 * Restores board back to the new game state
// 	 * 
// 	 * @param isWhite
// 	 *            player color
// 	 */
// 	public void newGame(boolean isWhite) {
// 		mBoardController.setPlayerColor(isWhite);
// 		mBoardController.resetList();
// 		mLogicController.resetPosition();
// 		mOverlayRenderer.getCheckmateDialog().setState(false, false);
// 		mOverlayRenderer.getMoveHistory().resetHistory();
// 	}
// }
// 
// Path: core/src/nkarasch/chessgdx/view/renderers/OverlayRenderer.java
// public class OverlayRenderer extends Stage {
// 
// 	private final Skin mSkin;
// 	private final PromotionTable mPromotionDialog;
// 	private final CheckMateTable mCheckmateDialog;
// 	private final EngineThinkingImage mEngineThinking;
// 	private final SlidingMenuGroup mSlidingMenu;
// 
// 	/**
// 	 * Foundation of the Scene2D based GUI.
// 	 *
// 	 * @param core
// 	 *            root of game, is passed in so GUI elements can trigger
// 	 *            {@link GameCore#restart()} and
// 	 *            {@link GameCore#newGame(boolean)}
// 	 */
// 	public OverlayRenderer(GameCore core) {
// 
// 		mSkin = new MenuSkin();
// 		ExitConfirmTable exitConfirm = new ExitConfirmTable(mSkin);
// 		SettingsMenuGroup settings = new SettingsMenuGroup(mSkin);
// 		mSlidingMenu = new SlidingMenuGroup(mSkin, exitConfirm, settings, core);
// 		mEngineThinking = new EngineThinkingImage(mSkin);
// 		mPromotionDialog = new PromotionTable(mSkin);
// 		mCheckmateDialog = new CheckMateTable(mSkin);
// 
// 		addActor(mPromotionDialog);
// 		addActor(mCheckmateDialog);
// 		addActor(settings);
// 		addActor(mSlidingMenu);
// 		addActor(mEngineThinking);
// 		addActor(exitConfirm);
// 	}
// 
// 	public void render() {
// 		act(Gdx.graphics.getDeltaTime());
// 		draw();
// 	}
// 
// 	public void dispose() {
// 		mSkin.dispose();
// 		super.dispose();
// 	}
// 
// 	/**
// 	 * @return UI element displaying the move history for both black and white
// 	 */
// 	public MoveHistoryTable getMoveHistory() {
// 		return mSlidingMenu.getMoveHistory();
// 	}
// 
// 	/**
// 	 * @return UI element for letting the user which piece they want to promote
// 	 *         their pawns to
// 	 */
// 	public PromotionTable getPromotionDialog() {
// 		return mPromotionDialog;
// 	}
// 
// 	/**
// 	 * 
// 	 * @return UI element informing the user when the board is in a check or
// 	 *         checkmate state
// 	 */
// 	public CheckMateTable getCheckmateDialog() {
// 		return mCheckmateDialog;
// 	}
// 
// 	/**
// 	 * @return Icon in the bottom left of the screen that rotates when the
// 	 *         engine is in the process of finding a move
// 	 */
// 	public EngineThinkingImage getEngineThinkingImage() {
// 		return mEngineThinking;
// 	}
// }


// Path: core/src/nkarasch/chessgdx/logiccontroller/backend/ChessLogicController.java
import nkarasch.chessgdx.GameCore;
import nkarasch.chessgdx.view.renderers.OverlayRenderer;
import chesspresso.Chess;
import chesspresso.move.IllegalMoveException;
import chesspresso.move.Move;
import chesspresso.position.Position;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;

package nkarasch.chessgdx.logiccontroller.backend;



public class ChessLogicController {

	private final ObjectMap<Integer, Array<Short>> mLegalMoveMap;
	private final UCIEngineInterface mUCIInterface;
	private Position mPosition;
	private final OverlayRenderer mOverlay;