Can anyone explain what `grundy(i)`

state represents in any standard nim-game?

Then we calculate `grundy(i) = MEX{ grundy(x) , grundy(y), grundy(z) }`

let this `MEX be 0 & non-zero `

, how a state which can’t be reached from current state can contribute to answer.

It will be helpful even if you could provide some links. @vijju123 @galencolin @ssjgz

Edit: I got some intuition behind these magic functions. If you also struggling then I would suggest checking out these resources:

The Intuition Behind NIM and Grundy Numbers in Combinatorial Game Theory

Sprague-Grundy theorem. Nim