I initially thought in this manner: Assume there is only one pile having n stones for now
- $$$ n = 0 $$$: winning state $$$ \implies g(0) = 1 $$$ (Can I even do this? I am not following the MEX rule but it is a winning state so g(0) can't be 0 so just assigned it 1)
- $$$ n = 1 $$$: losing state $$$ \implies g(1) = 0 $$$
- $$$ n = 2 $$$: winning state since you can go to a losing state, $$$ g(2) = mex(g(0), g(1)) = mex(1, 0) = 2 $$$
- $$$ n = 3 $$$: $$$ g(3) = 3 $$$ (winning state)
- $$$ n = 4 $$$: $$$ g(4) = 4 $$$ (winning state) and so on...
This is wrong probably because of my assumption in $$$ n = 0 $$$. An Example of where it fails:
- Say the game when there are 2 piles having 1 stone each: {1, 1}
- $$$ g(1) = 0 \implies $$$ using Sprague-Grundy theorem, $$$ g(Game) = g(1) \oplus g(1) = 0 \oplus 0 = 0 $$$
- $$$ g(Game) = 0 $$$ but it is not a losing state