Unlike Predict the Winner, we can't just track indices. The value of affects what moves are legal. Two positions with the same remaining piles but different are different states.
State: = max stones current player can get starting from pile with parameter . Also useful: precompute suffix sums. If I know total stones from pile onward, and I know what opponent gets, my stones = total opponent's stones.