Ahah! Found another major bug! Make sure you change to what I wrote in the post above and also make sure you change the line
Code:
return evalVal;
at the end of the minimax function to
Code:
if (mode==MAXIMIZE)
  return max;
else
  return min;
You were accidentally sending back the evalVal which will always be the last move the function looked at, NOT the best value! Try this and see how much it helps.