If the player plays the game with truly sticking to the original number in his / her mind, everything works fine. However, if the player pushes the guess to the limit and keep pressing higher and lower buttons, the guess result will become strange.
To avoid this situation, I set a simple condition to check the limit.
public void onPressHigher()
{
if (max != guess)
{
min = guess + 1;
NextGuess();
}
}
public void onPressLower()
{
if (min != guess)
{
max = guess - 1;
NextGuess();
}
}