@Override public void move(Piece piece, Position position, ResultHandler<GameState> resultHandler) { try { final Position oldPosition = piece2Position.get(piece); final GameState gameState = invokeMove(piece, position); resultHandler.result(gameState); nofityListeners(new Move(oldPosition, position)); } catch (Exception e) { handleException(e, resultHandler); } }
@Override public void startGame(ResultHandler<GameState> resultHandler) { try { clear(); moveTo(new Position('a', 1), new Piece(Color.RED)); moveTo(new Position('h', 8), gamePiece); final GameState gameState = createBoard(); resultHandler.result(gameState); } catch (Exception e) { handleException(e, resultHandler); } }