public int bestCell(int row, int pos){
		//Find the number of conflicts
		int[] colConflicts = colConflicts(row);
		int[] diagConflicts = diagConflicts(row);
		int[] totalConflicts = new int[colConflicts.length];
		for (int i = 0; i<colConflicts.length;i++){
			totalConflicts[i] = colConflicts[i] + diagConflicts[i];
		}
		//Decide which cell to move to
		int currentConflicts = totalConflicts[pos];
		int better = currentConflicts;
		ArrayList<Integer> betterIndex = new ArrayList<Integer>();
		for (int j = 0; j<totalConflicts.length;j++){
			if (totalConflicts[j] < better){
				better = totalConflicts[j];
				betterIndex.clear();
				betterIndex.add(j);
			}
			else if (totalConflicts[j] == better){
				betterIndex.add(j);
			}
		}
		//If we have the same number of conflicts
		Random random = new Random();
		int tryPos;
		if (currentConflicts == better){
			if ((betterIndex.size() == 1)) {
				return betterIndex.get(0);
			}
			while (true){
				tryPos = betterIndex.get(random.nextInt(betterIndex.size()));
				if (tryPos != pos){
					return tryPos;
				}
			}
		}
		else if (betterIndex.size() > 1){
			return betterIndex.get(random.nextInt(betterIndex.size()));
		}
		else{
			return betterIndex.get(0);
		}
		//return -1;
	}