projects
/
advent-of-code-19.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3678ced
)
Some tidying
author
Neil Smith
<neil.git@njae.me.uk>
Mon, 7 Dec 2020 14:22:17 +0000
(14:22 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Mon, 7 Dec 2020 14:22:17 +0000
(14:22 +0000)
advent25/src/advent25.hs
patch
|
blob
|
history
diff --git
a/advent25/src/advent25.hs
b/advent25/src/advent25.hs
index c3c0c1f17de6dab420291e2a11000bbee5cb2685..126fbc8f604f2fd63a40ece46f4fa89a8bb53c2f 100644
(file)
--- a/
advent25/src/advent25.hs
+++ b/
advent25/src/advent25.hs
@@
-31,7
+31,8
@@
runPreamble mem =
encodeCommands :: [String] -> [Integer]
encodeCommands :: [String] -> [Integer]
-encodeCommands cmds = map (fromIntegral . ord) $ concat $ map (++ "\n") cmds
+-- encodeCommands cmds = map (fromIntegral . ord) $ concat $ map (++ "\n") cmds
+encodeCommands = map (fromIntegral . ord) . concat . map (++ "\n")
decodeOutput :: [Integer] -> String
decodeOutput = map (chr . fromIntegral)
decodeOutput :: [Integer] -> String
decodeOutput = map (chr . fromIntegral)
@@
-46,7
+47,6
@@
powerList :: [a] -> [[a]]
powerList [] = [[]]
powerList (x:xs) = powerList xs ++ map (x:) (powerList xs)
powerList [] = [[]]
powerList (x:xs) = powerList xs ++ map (x:) (powerList xs)
-
passSecurity :: Machine -> [String] -> [String] -> String
passSecurity machine instructions items =
"You keep: " ++ (intercalate ", " keeps) ++ "\n\n" ++ (attemptSecurity machine instructions validDropset)
passSecurity :: Machine -> [String] -> [String] -> String
passSecurity machine instructions items =
"You keep: " ++ (intercalate ", " keeps) ++ "\n\n" ++ (attemptSecurity machine instructions validDropset)