title: MiniMax TicTacToe doesn't work (c)
body: <p>I have implemented a TicTacToe algorythm with MiniMax, but the problem is that the computer always just places an 'x' on the next possible spot instead of evaluating the game. Does anybody know why ? (The problem can only be in the MiniMax function, or the nextMove function.)
  Thanks a lot in advance !!
  Here's the code :</p>
  
  <pre><code>int MiniMax(struct Game g, enum Symbol pl){
  
  int score;
  if (pl==CROSS)
  {
      score = -98765;
  }
  else score = 98765;
  
  
  int temp_cross =0;
  int temp_circle =0;
  
  
  
  //base case
  if (game_over(g) == CROSS)
      return 10;
  else if (game_over(g) == CIRCLE)
      return -10;
  else if (game_over(g) == FULL)
      return 0;
  
  
  int x,y;
  for (y=0; y&lt;SIZE_Y_AXIS; y++)
  {
      for (x=0; x&lt;SIZE_X_AXIS; x++)
      {
          if (g.board.fields[x][y] == NONE)
          {
              if (pl == CROSS)
                  g.board.fields[x][y] = CROSS;
              else  g.board.fields[x][y] = CIRCLE;
              if (pl == CROSS)
                  temp_cross= MiniMax(g, CIRCLE);
              else temp_circle = MiniMax(g, CROSS);
              g.board.fields[x][y] = NONE;
  
  
              if ((pl == CROSS) &amp;&amp; (temp_cross &gt; score))
                  score = temp_cross;
              else if ((pl == CIRCLE) &amp;&amp; (temp_circle &lt; score))
                  score = temp_circle;
  
  
          }
      }
  }
  
  return score;
  </code></pre>
  
  <p>};</p>
  
  <pre><code>int nextMove(struct Game g, enum Symbol player){
  
  int score_cross = -865435;
  int score_cross_temp = 0;
  int cross_position = 1;
  int score_circle = 876545;
  int score_circle_temp = 0;
  int circle_position = 1;
  int x,y;
  for (y=0; y&lt;SIZE_Y_AXIS; y++)
  {
      for (x=0; x&lt;SIZE_X_AXIS; x++)
      {
          if (g.board.fields[x][y] == NONE)
          {
              if (player == CROSS)
              {
                  score_cross_temp = MiniMax(g, CROSS);
                  printf("%d ",MiniMax(g, CROSS));
                  if (score_cross_temp &gt; score_cross)
                  {
                      score_cross = score_cross_temp;
                      cross_position = (y)*3 + x+1;
                  }
  
              }
              else if (player == CIRCLE)
              {
                  score_circle_temp = MiniMax(g, CIRCLE);
                  if (score_cross_temp &lt; score_circle)
                  {
                      score_circle = score_circle_temp;
                      circle_position = (y)*3 + x+1;
                  }
              }
          }
      }
  }
  
  
  if (player == CROSS)
  {
      //printf("%d",cross_position);
      return cross_position;
  
  }
  else
  {
      //printf("%d",circle_position);
      return circle_position;
  }
  </code></pre>
  
  <p>};</p>