Nim is a mathematical game of strategy in which two players take turns removing (or "nimming") objects from distinct heaps or piles. The rules of the game are as follows, there are a number of stones to start with. This can range anywhere from 15-30 stones. Then the user must select 1, 2, or 3 stones to take from the pile. The computer then goes and selects 1, 2, or 3 randomly, except when there is 4, 3, or 2 stones left. In that case, the computer will play smart, and try to win the game. The game is won if the opposing player takes the final stone.