Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently writing a reversi AI. What it does is, it looks a few moves ahead and then evaluates the boards and gives them scores, depending on how good it is. I use a few methods for evaluating these scores.

For example, I have the formulas:

StoneScore = My Stones Amount - Opponent Stones Amount
PossibleMoveScore = My Possible Moves - Your possible moves
TotalScore = StoneScore + PossibleMoveScore

There are a lot more actually, but I've just created this as example.

However, as the game progresses, these functions are not really scaling. I mean if I'm getting a lot more stones then my opponent the StoneScorecan be like 40 and the PossibleMoveScore can be just like 10.

In this case the StoneScore is a very big contributer to the TotalScore. Is there a way I can make them equally important.

I know that the range of StoneScore is between 0 and 64. And the range of the PossibleMoveScore is (a rough guess, I have no idea acutally) between 0 and 2*Opponent Stones Amount

Is there a technique I can use to control these variables?

share|cite|improve this question
StoneScore can be positive or negative. – Henry May 26 '11 at 9:32
Absolutely, thanks :) – Timo Willemsen May 26 '11 at 9:38
PossibleMoveScore is at most 64-9. But in practice is always less than this because to have 9 of your pieces, means you have 8-9 of your opponents. So, a safe bet is 64-18 as a max PossibleMoveScore that [probably] cannot be reached. – picakhu Jul 25 '11 at 14:49

If you know that a variable $x$ lies in the range $x_\min$ to $x_\max$ you can normalise it to be between 0 and 1 via the transformation:

$$x_{\mathrm{rescaled}} = \frac{x - x_\min}{x_\max - x_\min}$$

and your total score will always be between 0 and 2.

More generally you can apply any monotonic function $f(\cdot)$ that satisfies $f(x_\min)=0$ and $f(x_\max)=1$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.