private int maxMove(Board prev, int depth, int alpha, int beta)
  {
  	moves++;
  	if(depth >= maxDepth) return prev.getScore(); // exceeded maximum depth
  	
  	int maxScore = MIN_SCORE;
  	Board b = new Board(prev);
  	
  	for(int j = 0; j < size; j++)
  	{
  		for(int i = 0; i < size; i++)
  		{
  			if(b.move(i, j)) // try move
  			{
  				int score = minMove(b, depth + 1, alpha, beta);
  				
  				if(score > maxScore)	maxScore = score;
  				if(maxScore >= beta) return maxScore;
  				if(maxScore > alpha) alpha = maxScore;
  				
  				b = new Board(prev);
  			}
  		}
  	}
  	
  	if(maxScore == MIN_SCORE) // no moves found
  	{
  		b.turn();
  		if(b.canMove()) { b.turn(); return minMove(b, depth + 1, alpha, beta); }
  		else return prev.getScore(); 
  	}
  	
		return maxScore;
  }