|
|
Scott Cram Inner circle 2678 Posts |
If you like the game of Nim, but would like to create your own variations, it can be difficult to work out the winning strategies.
At least, it used to be: I've just developed the Nim Strategy Calculator. It's an online tool, and it's free to use! Complete instructions are found here, but I went to great effort to make it as simple and direct as possible. Both the entries and the responses are done in plain language, so you should be able to use it with little help. You enter the data for single-pile or multi-pile Nim in a simple interview-type format, click the Calculate button, and the computer instantly gives you the rules you've selected, the most effective strategy, and even some tips to handle various situations. It does this in plain English, too. The faster your browser can execute Javascript and jQuery, the faster this will run in your browser. Because there's no unusual technologies employed, you should be able to use this on your Android, iOS, or iPad devices. There's even a Next Move calculator that gives you the best play or plays from the current arrangement in multi-pile Nim! This is a great way to learn about and/or practice versions of Nim which you may not have run into before, or even create custom variations (complete with winning strategies!). I'd love to hear any comments you have about this, because I would like to improve it as time goes on. |
Rizzo Inner circle East Coast 3346 Posts |
Scott, you are the man!
|
nlokers Regular user Grand Rapids, MI 142 Posts |
Pretty cool, any chance of you releasing the source code?
|
Scott Cram Inner circle 2678 Posts |
I'm not hiding the source code at all. Go to the Nim Strategy Calculator, and use your browser's menu or right click to view the source code. It's even commented (not as much as it should probably be).
Be aware that it uses both Javascript and jQuery. Also, note that the ^ mark in Javascript is not an exponent function (such as 10^3=1000), but rather a bitwise XOR function (results in 10^3=9, because 1010 XOR 0011 = 1001). |
Bill Hallahan Inner circle New Hampshire 3222 Posts |
Over 30 years ago I wrote a Nim program in Fortran that displayed a random number of rows from 3 to 6, put a random number of pieces in each row from 1 to 15 (I think the lower bound was 1, I don't remember). The program then asked whether whomever moved last would win, or lose. Finally, it asked whether the computer or the user would move first. Years later I rewrote it in C.
It also exclusive-or'ed the binary value in each row. I learned of this in a book by Irving Adler, although he just referred to parity of the binary digits in the rows. It's surprising that whether the game ends with the last player moving winning, or losing, the strategy is usually the same. It's the same until all rows but one row have only 1 piece in the row. Then the strategy is rather obvious between the two variations. The program did not hold people's interest for long. It almost always beat the typical user, so they soon lost interest. It is a very effective demonstration, and well worth learning to play without using a computer.
Humans make life so interesting. Do you know that in a universe so full of wonders, they have managed to create boredom. Quite astonishing.
- The character of ‘Death’ in the movie "Hogswatch" |
Scott Cram Inner circle 2678 Posts |
Quick update: I've moved the Nim Strategy Calculator here: http://gmmentalgym.blogspot.com/2010/11/......tor.html
|
The Magic Cafe Forum Index » » Magical equations » » Free Tool: Nim Strategy Calculator! (0 Likes) |
[ Top of Page ] |
All content & postings Copyright © 2001-2024 Steve Brooks. All Rights Reserved. This page was created in 0.03 seconds requiring 5 database queries. |
The views and comments expressed on The Magic Café are not necessarily those of The Magic Café, Steve Brooks, or Steve Brooks Magic. > Privacy Statement < |