module Main where -- all possible moves moves :: Int-> [Int] moves x = let valid :: Int-> Bool valid x = 0 < x in filter valid ([x-1, x-2, x-3]) -- we can win canwin :: Int-> Bool canwin x = any mustlose (moves x) -- we cannot win mustlose :: Int-> Bool mustlose x = x==1 || all canwin (moves x) -- only testing main = do mapM_ (\n-> putStrLn (show n ++ if canwin n then " wins." else " loses.")) [1..]