void AiMove(Board board) { IMoveStrategy minimax = new AlphaBeta(4); Move bestMove = minimax.execute(board); Action aFunction = () => { Debug.Log(minimax.getMessage()); //BoardManager.Instance.moveMadeUpdate(PlayerType.COMPUTER); var sourceCoordinate = GetXAndY(bestMove.getCurrentCoordinate()); var destinationCoordinate = GetXAndY(bestMove.getDestinationCoordinate()); selectedChessPiece = chessPieces[sourceCoordinate.Key, sourceCoordinate.Value]; sourceTile = board.getTile(bestMove.getCurrentCoordinate()); movedPiece = sourceTile.getPiece(); if (movedPiece == null) { sourceTile = null; } int tileCoordinate = bestMove.getDestinationCoordinate(); selectionX = destinationCoordinate.Key; selectionY = destinationCoordinate.Value; moveChessPiece(tileCoordinate, selectionX, selectionY); }; QueueMainThreadFunction(aFunction); }