title: Implement Minimax without recursion
body: <p>I am buiding a Tic Tac Toe solving robot. For practise, I wrote a Tic Tac Toe game using the minimax algorithm which worked very well. When I wanted to port my code to the controller, I found out that none of C/C++ compilers for this controller support recursive functions. Therefore, I need help converting this recursive minimax function to one that uses iteration or an internal stack :</p>
  
  <pre><code>int miniMax (char board[BOARD_DIM][BOARD_DIM], _Bool minNode, int *xBest, int *yBest)
  {
      int possibleMoves[NSQUARES][2];
      int nPossibleMoves = generateMoves(board, possibleMoves);
      char boardChild [BOARD_DIM][BOARD_DIM];
      int ind, x_ind, y_ind;
      int minScore, maxScore;
      if (gameOver(board))
          return evaluateState(board);
      else if (minNode)
      {
          minScore = +INFINITY;
          for (ind = 0 ; ind &lt; nPossibleMoves; ind++) 
          {
              duplicateBoard(board, boardChild);
              x_ind = possibleMoves[ind][0];
              y_ind = possibleMoves[ind][1];
              updateboard(boardChild, x_ind, y_ind, cPlayer);
              int score = miniMax(boardChild,!minNode ,&amp;x_ind ,&amp;y_ind);
              if (minScore &gt; score)
                  minScore = score;
          }
          return minScore;
      }
      else if (!minNode)
      {
          maxScore = -INFINITY;
          for (ind = 0 ; ind &lt; nPossibleMoves; ind++) 
          {
              duplicateBoard(board, boardChild);
              x_ind = possibleMoves[ind][0];
              y_ind = possibleMoves[ind][1];
              updateboard(boardChild, x_ind, y_ind, cComputer);
              int score = miniMax(boardChild,!minNode ,&amp;x_ind ,&amp;y_ind);
              if (maxScore &lt; score)
              {
                  maxScore = score;
                  *xBest = x_ind;
                  *yBest = y_ind;
              }
          }
          return maxScore;
      }
  </code></pre>
  
  <p>I'm totally lost on how to do this. 
  I appreciate any help :)</p>