Randomised version works
This commit is contained in:
parent
3d80a6847d
commit
e0cd78f64e
22
app/Main.hs
22
app/Main.hs
@ -1,7 +1,6 @@
|
||||
module Main (main) where
|
||||
|
||||
import System.Random
|
||||
import Data.List
|
||||
|
||||
ordinals :: [ String ]
|
||||
ordinals = [
|
||||
@ -99,12 +98,9 @@ wrapGifts (i, j, k) = map giftStr $ matchGifts (i, j, k)
|
||||
allGifts :: [ [ String ] ]
|
||||
allGifts = map wrapGifts $ reverse signatures
|
||||
|
||||
|
||||
|
||||
|
||||
-- tuples :: [ ( String, String ) ]
|
||||
-- tuples = zip (reverse ordinals) allGifts
|
||||
|
||||
selectGifts :: [ Int ] -> [ String ]
|
||||
selectGifts os = map (\t -> (fst t) !! (snd t)) ts
|
||||
where ts = zip allGifts os
|
||||
|
||||
concatLines :: [ String ] -> String
|
||||
concatLines ls = foldr (\a b -> a ++ "\n" ++ b) "" ls
|
||||
@ -139,9 +135,9 @@ randomInts gen n = take n $ randoms gen
|
||||
main :: IO ()
|
||||
main = do
|
||||
gen <- newStdGen
|
||||
let offsets = randomOffsets gen allGifts
|
||||
print offsets
|
||||
print allGifts
|
||||
|
||||
|
||||
-- putStrLn $ foldr (\a b -> a ++ "\n\n" ++ b) "" $ reverse $ recurseVerse tuples
|
||||
let roffsets = randomOffsets gen allGifts
|
||||
print roffsets
|
||||
print (selectGifts roffsets)
|
||||
print (selectGifts $ reverse offsets)
|
||||
let tuples = zip ordinals $ selectGifts roffsets
|
||||
putStrLn $ foldr (\a b -> a ++ "\n\n" ++ b) "" $ reverse $ recurseVerse tuples
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user