From ac754cb57039b13077af5225f61c43c90b450cfb Mon Sep 17 00:00:00 2001 From: Shaun Kerr Date: Fri, 22 Jun 2018 16:10:26 +1200 Subject: [PATCH] Better printing --- .Main.hs.swp | Bin 24576 -> 28672 bytes Main.hs | 16 ++++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.Main.hs.swp b/.Main.hs.swp index fd8a81384aac021ee8faaac9321c24d995aa3490..e48527eafea594028a34c6f68e67ee55b73bfc0b 100644 GIT binary patch delta 654 zcmYk3OKTKC5XXC>>jTWrL_!u#B*hYNCYd}|4~A8DB}POv9t zFh4WLa5;>Pcl_3aD<4Mw*vCuk3BC=Ono}|0IMxoG&K#peT&4cTc8lGjXm;OuX1|1^ zgS$3kdk9IE%n($pz08B>_UT|-#fgSRuKCOoe=H<3pJyBOS7pY&B9wo!Q2c`RuMvT) zB6pDsNCo*<QJm+hh@#R%x*924^Do>5q=^xu2qan_aDf2OoOr>l7o9%!Ja-CO~`!pkK9sy8|^*-E60>TpkXf>dt8 O^*E8REH!j5R@r}h3YMn; delta 456 zcmZp8z}RqrQ7p+I%+puFLeGE!2m}}y?iA@nM~ZJ0d&AGq!cY$sV**J40n21T0eQxn z$%X>roU9Nb2A0i*0{#3G7br|pVBwv`&%kgDh(V?R6)T7{p4_ad(9J*juD>8-=Hz4g zc22f~`U_l1%1gL;IbwNtrr8MVdglXokcT1_o`QwdNo{ z0i95@S!CVCZv^i}3 diff --git a/Main.hs b/Main.hs index 4c9e323..9acb757 100644 --- a/Main.hs +++ b/Main.hs @@ -2,6 +2,7 @@ module Main2 where import System.Random import Data.List +import Data.Maybe import Packs data Timestamp = Ts Integer Integer Integer @@ -125,17 +126,20 @@ getPreview n (l, p, b, r) packsChange = diffRot nl l (nl, _, _, _) = newRotation (l, p, b, r) -cleanMaybe :: BigBox -> [String] -cleanMaybe (Bb (Just x)) = [x] -cleanMaybe (Bb Nothing) = [] +printLegal :: State -> [String] +printLegal (l, p, b, r) = [ + "Evergreen: Revised Core Set x3" + , "Deluxes : " ++ (intercalate ", " $ sort $ catMaybes (tail $ map (\(Bb x) -> x) b)) + , "Datapacks: " ++ (intercalate ", " $ sort $ map (\(Dp n _) -> n) l) + ] printPreview :: Preview -> [String] -printPreview (i, o, bi, bo) = [ +printPreview (i, o, (Bb bi), (Bb bo)) = [ ("In : " ++ (intercalate ", " $ (cleanDP i) ++ cbi)) , ("Out: " ++ (intercalate ", " $ (cleanDP o) ++ cbo)) ] where rmEmp = filter (/="") - cbi = cleanMaybe bi - cbo = cleanMaybe bo + cbi = catMaybes [bi] + cbo = catMaybes [bo] cleanDP = map (\(Dp n _) -> n)