C++ (DP, BFS, BitMask) Approach explained
Approach\nApproach:\ni) Use BFS to find no. of moves to reach from each point to all other points.\nii) Use DP to try all possible ways of capturing pawns.\n   
# Approach\nApproach:\ni) Use BFS to find no. of moves to reach from each point to all other points.\nii) Use DP to try all possible ways of capturing pawns.\n    DP state will be (idx, turn, pawnMask).\n    idx will keep track of the position we are at (idx==2 means positions[2]). (n possible positions)\n    turn will keep track of whose turn it is Alice or Bob. (2 possibilities)\n    pawnsMask is a bitMask that keeps track of all the pawns that have already been captured in our current path. (1<<n possibilities)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    // knight movements\n    int r[8] = { -2, -1, 1, 2, -2, -1, 1, 2 };\n    int c[8] = { -1, -2, -2, -1, 1, 2, 2, 1 };\n\n    // checks whether a position is inside the board\n    bool isInside(int r, int c){\n        if(r>=0 && r<50 && c>=0 && c<50) return true;\n        return false;\n    }\n\n    // BFS function to calculate the no. of movess required to move from one source position to another target position\n    int minDist(int src, int tar, vector<vector<int>>& positions){\n        int row = positions[src][0];\n        int col = positions[src][1];\n\n        queue<pair<pair<int,int>,int>> q;\n        q.push({{row,col},0});\n\n        vector<vector<int>> vis(50, vector<int>(50,0));\n\n        vis[row][col]=1;\n\n        while(!q.empty()){\n            int rowTemp = q.front().first.first;\n            int colTemp = q.front().first.second;\n            int moves = q.front().second;\n\n            q.pop();\n\n            for(int i=0; i<8; i++){\n                if(isInside(rowTemp+r[i], colTemp+c[i]) && !vis[rowTemp+r[i]][colTemp+c[i]]){\n                    vis[rowTemp+r[i]][colTemp+c[i]]=1;\n                    if(positions[tar][0]==rowTemp+r[i] && positions[tar][1]==colTemp+c[i]){\n                        return moves+1;\n                    }\n                    q.push({{rowTemp+r[i],colTemp+c[i]},moves+1});\n                }\n            }\n        }\n        return -1;\n    }\n\n    // The recursive function that solves the question\n    int solve(int idx, int turn, int pawnsBit, vector<vector<int>>& positions, \n                    vector<vector<int>> &dis, vector<vector<vector<int>>> &dp, int n)\n    {\n        if(pawnsBit == (1<<n)-1) return 0;  // when all n bits are 1 that means all pawns have been captured\n\n        if(dp[idx][turn][pawnsBit] != -1) return dp[idx][turn][pawnsBit];\n\n        int temp = (turn==1) ? INT_MIN : INT_MAX;\n\n        // Alice will try to maximize\n        if(turn){\n            for(int i=1; i<n; i++){\n                if((pawnsBit & (1<<i)) == 0){\n                    temp = max(temp, dis[idx][i] + solve(i, !turn, (pawnsBit | 1<<i), positions, dis, dp, n));\n                }\n            }\n        }\n        // Bob will try to minimize\n        else{\n            for(int i=1; i<n; i++){\n                if((pawnsBit & (1<<i)) == 0){\n                    temp = min(temp, dis[idx][i] + solve(i, !turn, (pawnsBit | 1<<i), positions, dis, dp, n));\n                }\n            }\n        }\n\n        return dp[idx][turn][pawnsBit] = temp;\n    }\n\n    // main function\n    int maxMoves(int kx, int ky, vector<vector<int>>& positions) {\n        positions.insert(positions.begin(), {kx,ky});  // the initial knight position is also inserted\n\n        int n = positions.size();\n\n        vector<vector<int>> dis(n, vector<int>(n,0));\n\n        for(int i=0; i<n; i++){\n            for(int j=i+1; j<n; j++){\n                dis[i][j] = minDist(i,j,positions);\n                dis[j][i] = dis[i][j];\n            }\n        }\n\n        vector<vector<vector<int>>> dp(n, vector<vector<int>>(2,vector<int>((1<<n), -1)));\n\n        return solve(0,1,1,positions,dis,dp,n);\n    }\n};\n```
['C++']