
Nim
Nim is a strategic mathematical game involving two players who take turns removing objects from distinct piles. On each turn, a player must remove at least one object from a single pile. The goal is to be the last to remove an object. The game's outcome hinges on a concept called the "nim-sum," which involves binary addition of the pile sizes. If the nim-sum is zero, the player about to move is in a losing position if the opponent plays perfectly; if it's non-zero, that player has a winning strategy by making moves that leave a zero nim-sum for the opponent.