Last active
October 6, 2015 23:58
-
-
Save gfixler/84a81e9fd8ee64d42635 to your computer and use it in GitHub Desktop.
Militia Name Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Clojure -> Haskell port of: https://gist.github.com/nasser/1db446782cf7f3587283 | |
import System.Random (getStdRandom, randomR) | |
pick :: [a] -> IO a | |
pick xs = do | |
n <- getStdRandom $ randomR (0, length xs - 1) | |
return $ xs !! n | |
adjs = ["people's", "brave", "invincible", "unstoppable", "righteous", "just", "honorable", "terrifying", "peaceful"] | |
whos = ["striking hand", "liberators", "children", "sons and daughters", "defenders", "friends", "guardians"] | |
orgs = ["movement", "army", "militia", "party", "kinship", "revolution", "front"] | |
pres = ["tel", "jourat", "borj", "wadi", "ras", "jal", "jabal", "ain"] | |
plcs = ["zaatar", "heem", "kfour", "ghodras", "tirmos"] | |
bigs = ["people", "zaim", "sultan", "world", "earth", "oppressed", "forgotten", "poor"] | |
genMilitia :: IO String | |
genMilitia = do | |
org <- pick orgs | |
adj <- pick adjs | |
who <- pick whos | |
big <- pick bigs | |
pre <- pick pres | |
plc <- pick plcs | |
who' <- pick [who, org, adj ++ " " ++ org] | |
plc' <- pick [big, plc, pre ++ " " ++ plc] | |
return $ unwords ["the", who', "of the", plc'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
love it!