As can be seen below, you start with a random number of coins. You take turns with the computer in removing 1, 2 or 3 at a time. The player who removes the last coin looses. Sounds simple until you try it. By the way, before you reach for your e-mail programs to tell me that it is impossible, you can always win providing you don't make a mistake.

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

A Bit of History

Back in the dark and dismal days of 1981 when I started programming on a Sinclair ZX81, home computers were for hobbyists. They were often just a circuit board with all the components mounted directly onto it - no motherboard and peripheral cards like today's PC's. If you spent a bit more money, you might get a case for the thing!

No one seemed to care that they had so little computational power so as to be of little practical value. My ZX81 initially had just one kilobyte of memory, compared to 1,048,576 times that on my current system. It had no hard disk, not even a floppy, program storage was a standard audio cassette and recorder, however it was fascinating to watch that tiny machine obey the simple commands that I gave it.

Before "compatibility" became the big issue, every machine had its own operating system and all seemed to have their own version of the BASIC programming language. The hobby magazines would discuss how to make your own add on hardware and teach different programming techniques. Often, in the back there would be program listings to be laboriously typed in. On such listing was for a game called "Nim". Here is a version I have written in java.