home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
RISC DISC 2
/
RISC_DISC_2.iso
/
pd_share
/
program
/
language
/
gofer
/
scripts
/
Grundy
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1993-03-08
|
213 b
|
11 lines
--- Grundy numbers
data Game = Moves [Game]
grundy :: Game -> Int
grundy (Moves gs) = least (\n -> and [n/=grundy g|g<-gs])
least p = x where x:_ = [ n | n <- [0 ..], p n ]
nim n = Moves [nim m|m<-[0..(n-1)]]