Nim-Heap

Author

Eric W. Weisstein
January 25, 2011

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Games/Nim-Heap.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Nim-Heap.html.

©2010 Wolfram Research, Inc. except for portions noted otherwise

Code

Counter[n_,y_]:=Module[{dx=.1,h=.2,dy=.05},
Rectangle[{n+dx,(y-1)(dy+h)},{n+1-dx,(y-1) (h+dy)+h}]
]

NimHeap[l__]:=Counter@@@Flatten[MapIndexed[Outer[List,#2,#1]&,Range/@{l}],2]

Figure

V5

Show[Graphics[NimHeap[1,3,5,7],AspectRatio->Automatic]]

V6

Graphics[NimHeap[1,3,5,7]]