Standard Nim gives you XOR of pile sizes. But what about games where the rules differ per pile? Games where you can remove 1, 2, or 3 stones only? Games where you split a pile into two? These are ALL Nim in disguise.
Sprague–Grundy theorem (1935-1939): Every impartial combinatorial game is equivalent to a Nim heap of a certain size. That size is called the Grundy number (or nim-value). The XOR of Grundy numbers of sub-games determines the winner — exactly like Nim-sum!
This is NOT just theory — advanced Nim variants appear in Codeforces, CSES, HackerRank, and AtCoder. The problems in this article cover 6 distinct variants that build on the Grundy framework.