Data Abstraction Example: Programming a Game
The game of Nim:
- There are two piles of objects, say coins.
- Two players take turns removing coins.
- Each turn consists of taking one coin or
more as long as they are from the same
pile.
- The winner is the player who takes the
last coin (or coins).
Variations:
- More than two piles.
- Player who takes last coin is the loser.