Nim Sum Calculator Applet
Glenn A. Richard
Glenn.Richard@sunysb.edu
This applet is designed to compute a nim sum, which you can use to pursue a wining strategy in the game of nim. The player with a zero nim sum is in a losing position, therefore the winning strategy is to take the necessary quantity of toothpicks from the appropriate heap to give your opponent a zero nim sum. If you maintain this position throughout the game, you will win.
How to Use This Applet
This applet computes a nim sum for three-heap nim. You can set the quantity for the three heaps by typing numbers into the text fields in the decimal column or in the binary columns. For a number to take effect, you need to hit the enter key while the insertion point is in the text field for the number that you changed. Decimal numbers can range from 0 to 255. Each binary digit must be a 0 or a 1.
The "Subtract 1" buttons decrement the number of toothpicks in the corresponding heaps.
The nim sum is displayed in the bottom row. When all the binary digits in that row are 0, the nim sum is 0.
Source Code
last modified November 14, 2000