Day5: Part1 works

This commit is contained in:
Arranun 2019-12-05 23:40:54 +01:00
parent 3ebc6755af
commit e9a6550480

View File

@ -2,8 +2,8 @@ import Data.List.Split
import Data.Char as Char
main = do
let content = [1002,4,3,4,33]
let input = []
content <- getList <$> getContents
let input = [1]
let output = operation content content 0 input []
mapM putStrLn (map show output)
@ -33,7 +33,7 @@ compute (op:x:y:z:_) state index input output=
operation :: [Int] -> [Int] -> Int -> [Int] -> [Int] -> [Int]
operation (99:_) state index input output =
state
output
operation (op:x:y:z:_) state index input output
| last (digits op) == 1 = do
let newindex = index + 4
@ -74,7 +74,7 @@ put(op1:op2:m1:_) p1 input state =
out :: [Int] -> [Int] -> Int -> [Int] -> [Int]
out (op1:op2:m1:_) output p1 state =
output ++ [(state !! (getValue m1 p1 state))]
output ++ [(getValue m1 p1 state)]
insert :: [Int] -> Int -> Int -> [Int]
insert xs value index = do