0
$\begingroup$

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?

  • 0
    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.2011-07-25

1 Answers 1

1

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$.