# Probability for Expectimax in Connect 4?

How should we be evaluating the probabilities for the expectimax function? Are they all evenly distributed?

Yes, evenly distributed! Assume all opponent actions are equally likely...

answered by (15.5k points)
selected

At the beginning of the game we have 7 column that are not full, so the probability for each is 1/7. Later in the game it does changes. You can get the number of open columns before entering the loop it will help preference. There are two different way to get the probability(open columns your denominator) for the current node call. We are given a method called _getLegalActions() that will give you number by taking the length, but it's a private method so it's not recommended. Second option is to check the length of pairs that are being returned by curNode.getActionsAndSuccessors(), that will give you the same number of open columns. Since selecting each column is equally likely you just need the number of open columns.

answered by (2.6k points)