All problems
Expectimax Value
Problem
Compute the expectimax value of a shallow tree with a maximizing root and uniform chance nodes.
Each child's value is the average of its leaves. Return the maximum value over the children.
Hint
Chance nodes average and the max node takes the best expectation.
Test cases
case 1
in: [[[1,3],[2,2]]]
expected: 2
case 2
in: [[[0,10],[5,5],[1,1]]]
expected: 5
case 3
in: [[[3]]]
expected: 3
case 4
in: [[[0,1],[0,2]]]
expected: 1
Starter codePython
def expectimax_value(tree):
# Your code here
pass4 test cases · run your code against them in the editor