home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.uni-stuttgart.de/pub/systems/acorn/
/
Acorn.tar
/
Acorn
/
acornet
/
dev
/
gofer.spk
/
scripts
/
Grundy
< prev
next >
Wrap
Text File
|
1993-03-08
|
213b
|
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)]]