I understand the algorithm, as it applies to Alpha-Beta pruning. What I don’t understand is since there is no way to represent ∞ in Java, on my first call to the Minimax method, what value should Alpha and Beta be to start out with? (Normally I would think you could make them -∞ and +∞). The only thing I could think of would be 0, but would that produce some unwanted results? Thanks!
I understand the algorithm, as it applies to Alpha-Beta pruning. What I don’t understand
Share
It depends on the data type you’re using.
-∞and+∞simply mean the lowest and highest values possible.If you pick
int, the respective values can beInteger.MIN_VALUEandInteger.MAX_VALUE. The algorithm will work just fine.Also, infinity can be represented in Java. If you really want to, you can use
float, which has both a positive and negative infinity value. You could just useFloat.POSITIVE_INFINITYandFloat.NEGATIVE_INFINITY. For this algorithm,though, I’d stick with integers. Just because they’re free from all possibly unexpected behavior related to rounding and precision.