Improved AI difficulty algorithm