Think this is just a bunch of sticks? Think again. Nim is a deceptively simple game of strategy, foresight, and just a tiny bit of mischief. The rules are easy: take turns removing sticks from a single row. The twist? Nobody wants to take the last one. Leave your opponent staring at that lonely final stick, and victory is yours. Every move matters. One careless grab and—oops—you’ve handed your opponent the win. Play smart, think ahead, and try not to look too suspicious when you leave them with “just one.” Whether you’re here to outwit the AI, challenge a friend, or watch two machines battle it out in silent calculation, Nim promises clever tactics, zero luck, and absolutely no draws. Ready to make your move? Choose wisely… 🧠✨
This is a two-player strategic game called Nim. At first glance the rules are simple, but victory demands careful planning. The goal is to force your opponent to be left with exactly one stick. Whoever faces the final solitary stick loses the game. Each move becomes a tactical decision—players must think several steps ahead, carefully removing sticks while setting traps that corner their opponent into the unavoidable final move.
The game board consists of three rows of sticks: Row 1: 3 sticks Row 2: 5 sticks Row 3: 7 sticks The game begins with a total of 15 sticks.
The game is played by two players taking alternating turns. On a player’s turn: They may remove one or more sticks. All removed sticks must come from exactly one row. Removing sticks from multiple rows in a single turn is not allowed. Players continue alternating turns until the game reaches a terminal state. The game ends when only one stick remains on the board. The player who is left with that final stick loses the game.
The game is deterministic, finite, and has perfect information. The game is guaranteed to never result in a draw — one player must always lose.
Human vs AI Human vs Human AI vs AI (autoplay / simulation mode)
Easy – Random or shallow-depth strategy Medium – Depth-limited Minimax with Alpha–Beta pruning Hard – Full optimal Minimax with Alpha–Beta pruning (perfect play) Difficulty selection should affect only AI players and be configurable at game start.
If you add unit tests, include instructions to run them here (for example, using pytest):
pip install pytest
pytestMIT License.
If you have questions or suggestions, open an issue or submit a pull request. Mention @santakd for visibility.