NIM — credits, sources and what is original =========================================== This is an INDEPENDENT REIMPLEMENTATION, written from published rules and published mathematics. No code, artwork, sound, level data or asset from any other implementation of these games was used, read or converted. Everything that ships here — the engine, the board drawing, the pin shapes, the lens panel, the stylesheet, the icons and the social card — was written for this app. THE GAMES --------- NIM. Public domain. The game is far older than any of the sources below and has no known author. The NAME was proposed by Charles L. Bouton, who also published its complete theory: Charles L. Bouton, "Nim, A Game with a Complete Mathematical Theory", Annals of Mathematics, Second Series, Vol. 3, No. 1/4 (1901–1902), pp. 35–39. Mathematics Department, Princeton University. JSTOR stable URL: https://www.jstor.org/stable/1967631 Bouton's section 2 gives the normal-play rule this app's opponent uses: write each heap in binary and a position is safe when every binary column sums to an even number. Bouton's section 6 gives the misère rule, in his own words: "This modified game can also be generalized to any number of piles. The safe combinations are the same as before, except that an odd number of piles, each containing one, is now safe, while an even number of ones is not safe." Bouton credits the misère variant itself to Mr. Paul E. More, who described it to him in October 1899 along with a method of play he could not prove. KAYLES. Invented by Henry Dudeney: H. E. Dudeney, The Canterbury Puzzles, 1908; puzzle 73, pp. 118–119 (Dover reprint, 2002, ISBN 0-486-42558-4). Its normal-play theory is: R. K. Guy and C. A. B. Smith, "The G-values of various games", Proceedings of the Cambridge Philosophical Society, 52 (1956), 514–526. The nim-value sequence for a single row is OEIS A002186. This app does NOT ship that table: it recomputes the values in your browser from the move rule, and the build harness compares all 105 recomputed terms against two independent publications of the sequence (the table in the Wikipedia article on Kayles for n = 0…83, and the OEIS A002186 b-file for n = 0…104). All 105 agree. Misère Kayles was solved by William Sibert in 1973 and published in 1989; see also T. E. Plambeck, "Daisies, Kayles and the Sibert-Conway decomposition in misère octal games", Theoretical Computer Science 96 (1992), 361–388. This app does not implement that solution. Where it offers misère Kayles it solves the position by exhaustive search, and refuses to answer for positions too large to search rather than guessing. THE SUBTRACTION GAME. The S = {1, 2, 3} subtraction game is folklore; it is not Dudeney's or Bouton's, and it is here as the simplest possible illustration that a heap of n is equal to a Nim heap of n mod 4. THE SPRAGUE–GRUNDY THEOREM. Discovered independently by R. P. Sprague (1935/36) and P. M. Grundy (1939). Every impartial game under the normal play convention is equivalent to a single Nim heap. That theorem is the reason three different games can share one engine here. WHAT DIFFERS FROM THE ORIGINALS ------------------------------- * Bouton's paper describes THREE heaps and generalises to any number at the end. This app plays any number of heaps from the start. * Bouton's rule is stated for positions; the opponent here also needs to choose BETWEEN equally winning moves, which the paper does not specify. When several winning moves exist the opponent picks among them at random from a seeded generator; when it is losing it stalls, leaving as much on the table as it can. * The "Strong" and "Careless" opponent settings are this app's invention: they play the perfect move only some of the time and otherwise move at random. There is no such notion in any of the sources. * Kayles is traditionally a single row. This app also offers openings with two rows, which is just a Kayles position that a first move could have produced. * The board is drawn as counters and as bowling pins; no original artwork of any kind was consulted or reproduced. * Everything in the "What the numbers say" panel — the accuracy of the counting heuristic, the conversion rates, the misère divergence frequencies — was measured by this project's own harness and is not taken from any publication. TRADE MARKS ----------- "Nim" and "Kayles" are used here descriptively, as the ordinary names of the games themselves. No affiliation with, sponsorship by, or endorsement from any publisher, estate or organisation is claimed or implied. THIS IMPLEMENTATION ------------------- Code and artwork: © 2026 SkillSafe, MIT licence — see LICENSE.txt. It runs entirely in the browser, makes no network requests, and stores only your own settings and win/loss tally on your own device.