I'm not really sure how it works but I would do something like this:
1. Divide the guess and previous guess by the total number( Say the guess can only go up to 1000)
2. Take the absolute value of ( guess - previous ).
3. Multiple the answer by 100. ( Turn it into a percent )
4. Check to see if the answer is less than one using an if statement.
You can try something like this but it might not work.