There is an old game called Nim. To play it, one needs a pile of stones (and a partner).
The two players take turns removing stones from the pile. A player's move consists of taking either 1 or 2 or 3 stones from the pile. A player cannot pass (i.e. take no stones in his turn). The player who has to take the last stone loses the game (and gets to clean up the mess).
Here are the transcripts of two games, played, let's say, by Chewbacca and R2D2. The pile initially contained 10 stones, Chewbacca had the first move.
Ch 3, R2 3, Ch 1, R2 2, Ch 1 (*Growl*) Ch 1, R2 2, Ch 1, R2 1, Ch 3, R2 1, Ch 1 (*GROWL*)
You can write either one or both of the following programs: