The Magic Café
Username:
Password:
[ Lost Password ]
  [ Forgot Username ]
The Magic Cafe Forum Index » » Magical equations » » Free Tool: Nim Strategy Calculator! (0 Likes) Printer Friendly Version

Scott Cram
View Profile
Inner circle
2677 Posts

Profile of Scott Cram
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
View Profile
Inner circle
East Coast
3212 Posts

Profile of Rizzo
Scott, you are the man!
nlokers
View Profile
Regular user
Grand Rapids, MI
143 Posts

Profile of nlokers
Pretty cool, any chance of you releasing the source code?
Scott Cram
View Profile
Inner circle
2677 Posts

Profile of Scott Cram
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
View Profile
Inner circle
New Hampshire
3223 Posts

Profile of Bill Hallahan
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
View Profile
Inner circle
2677 Posts

Profile of Scott Cram
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-2021 Steve Brooks. All Rights Reserved.
This page was created in 0.12 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 <

ROTFL Billions and billions served! ROTFL