To me, nimsum is what you use to solve the game of Nim.  It is NS as 
described in the article.  A Nim position with nimsum=0 is a loser for 
the player with the move.  You calculate it by writing the number of 
stones in the piles in binary, and adding them up in binary, EXCEPT that 
you discard any carries produced during the addition.

You win a Nim game by always making a move that leaves the nimsum=0.  It 
is easy to prove that such a move is possible iff the nimsum is not 0 
already.

Henry Rich

Ian Clark wrote:
> In: http://www.jsoftware.com/jwiki/Doc/Articles/Play191 (Chapter 31, J
> be nimble, J be quick)
> the version of mt attributed to Mike Day fails with value error: nimsum
> 
> Can anyone see what nimsum is supposed to be? It only occurs once
> (outside a comment). I've tried equating it to the verb NS, the "nim
> sum" derived at the start of the article, but although mt then runs,
> it does not produce the same table as the previous definition of mt
> (quite apart from needing to be run as (mt 4) not (mt 5) like the
> previous one).
> 
> Ian Clark
> Subeditor, APWJ Edn 2.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to