{-# LANGUAGE ScopedTypeVariables #-}
{-
Copyright 2012 Ken Takusagawa
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
"; replicateM_ n $ sator >>= putStr; putStrLn "
"; }; main :: IO (); main = do { args <- getArgs; case args of { [n] -> html $ read n; _ -> do { replicateM_ 30 $ randomword >>= putStrLn; mapM_ print g_; print $ sum$ map logbits $ concat g_; putStrLn $ unwords vowel; print $ length vowel; putStrLn $ unwords allconsonants; print $ length allconsonants; print $ length $ nub allconsonants; putStrLn $ table $ map (map show) g_; }; }; }; gridchoices :: Int -> Int -> Int; gridchoices i j = length $ letterchoices [i,j]; g_ :: [[Int]]; g_ = map (\x -> map (gridchoices x) [0..4]) [0..4]; logbits :: Int -> Double; logbits i = (log(fromIntegral i))/(log 2); letterchoices :: [Int] -> [String]; letterchoices i = case (mod(sum i)2) of { 1 -> vowel; _ -> concat [anycons , some (== 4) click , some (== 0) r1 , some (\x -> x<4) extra , some (\x -> x>0) nnn , some (\x -> x/=0 && x/=4) ncenter ] where { test :: (Int -> Bool) -> Bool; test p = all p i; some :: (Int -> Bool) -> [String] -> [String]; some p l = mguard (test p) l; } }; htmlmakecol :: Int -> Int -> IO String; htmlmakecol i j = randomchoose $ letterchoices [i,j]; tablecell :: String -> String; tablecell x = "