Skip to content

Instantly share code, notes, and snippets.

@gfixler
Last active October 6, 2015 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfixler/84a81e9fd8ee64d42635 to your computer and use it in GitHub Desktop.
Save gfixler/84a81e9fd8ee64d42635 to your computer and use it in GitHub Desktop.
Militia Name Generator
-- 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']
@nasser
Copy link

nasser commented Oct 6, 2015

love it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment