Accepted answer

It seems that alpha is initialized with the wrong value:

var alpha = -player * Double.PositiveInfinity

means that in case of the X player (-1) alpha is initialized as

var alpha = - (-1) * Double.PositiveInfinity

which can be simplified to

var alpha = Double.PositiveInfinity

Thus, alpha cannot increase anymore, i.e.

alpha = if (player == -1) Math.max(alpha, score) else //...

will have no effect. The reverse should be true for the other player (1), where alpha is initialized as negative infinity and thus cannot be mimized anymore. Thus, you should be able to fix this by simply removing the -1 factor from the initialization of alpha:

var alpha = player * Double.PositiveInfinity

More Query from same tag