Ludii Forum
Original version of NIM - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Suggestions (https://ludii.games/forums/forumdisplay.php?fid=10)
+--- Forum: Games to Include (https://ludii.games/forums/forumdisplay.php?fid=12)
+--- Thread: Original version of NIM (/showthread.php?tid=15)



Original version of NIM - fbarbe - 12-19-2019

The only NIM game in Ludii Player 0.5.0 is described on wikipedia as a "misère" variant of nim.

I have attached the .lud code of the original nim game as described on Wikipedia, in case you want to add it in the "NIM" folder.

It seems that .lud files are not allowed to be attached to threads in this forum...
Here is the code:

(game "Nim" 
  (players 2) 
  (equipment {
    (board (rect 1 3))
(piece "Ball" None)
  }
  ) 
  (rules
  (start {
  (fill "Ball0" (bottom) counts:{3 4 5} onStack:true)
  }
  )
 
    (play
    (if (isMover Prev)
    (or
    (select (lastToMove) (then (and (remove (lastToMove) ) (if (not (= (height (lastToMove) ) 1) ) (moveAgain) ) ) ) )
    (pass)
    )
    (select (occupiedBy None) (then (and (remove (lastToMove) ) (if (not (= (height (lastToMove) ) 1) ) (moveAgain) ) ) ) )
    )
    )

    (end (if (stalemated Next) (result Mover Win) ) )
  )
)


(metadata
{ "hideBoard" "true" }
  { "Source" "https://en.wikipedia.org/wiki/Nim"}
  { "rules" "Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps or piles.
On each turn, a player must remove at least one object, and may remove any number of objects provided they all come from the same heap/pile
The player that takes the last hand wins." }
)


RE: Original version of NIM - cambolbro - 12-23-2019

Thanks for that. We'll include both versions of the games as an option.