feature-random #1

Merged
bombinans merged 6 commits from feature-random into main 2025-12-24 03:23:53 +00:00
Showing only changes of commit e0cd78f64e - Show all commits

View File

@ -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