Formula to get a score for accuracy
My app allows users to guess the age of a person based on a photo. I want to score the guesser's accuracy.

The variables I think I need:

 - **$total_guess** = total number of guesses
 - **$user_guess**  = total number of guesses for the given user
 - **$over**        = the over/under of each guess (whether the user guesses their age to be older or younger doesn't matter -- just the difference between the guess and the age)

Consider that a user with 100 guesses and 10 years $over is a better guesser than someone with 10 guesses and 10 years of $over.

Looking for a PHP solution.
Formula to get a score for accuracy
===

My app allows users to guess the age of a person based on a photo. I want to score the guesser's accuracy.

The variables I think I need:

 - **$total_guess** = total number of guesses
 - **$user_guess**  = total number of guesses for the given user
 - **$over**        = the over/under of each guess (whether the user guesses their age to be older or younger doesn't matter -- just the difference between the guess and the age)

Consider that a user with 100 guesses and 10 years $over is a better guesser than someone with 10 guesses and 10 years of $over.

Looking for a PHP solution.