From 21def8762b83f33875ef5cd44c53c78e37be1c7f Mon Sep 17 00:00:00 2001 From: Agatha Lovelace Date: Sat, 4 Dec 2021 22:49:57 +0200 Subject: [PATCH] Oops i forgot to update comments --- Day4_1.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Day4_1.hs b/Day4_1.hs index 16994ab..3545f95 100644 --- a/Day4_1.hs +++ b/Day4_1.hs @@ -35,7 +35,7 @@ checkBoard board nums = any (isLineWinning nums) allLines where allLines = board ++ map (column board) [0..4] --- in: list of boards, list of random numbers +-- in: list of boards, list of random numbers, accumulator -- out: boards that won, number of iterations checkBoards' :: [Board] -> [Int] -> [(Board, Int)] -> [(Board, Int)] checkBoards' [] nums acc = acc @@ -43,6 +43,7 @@ checkBoards' (x:xs) nums acc | checkBoard x nums = checkBoards' xs nums (acc ++ [(x, length nums)]) | otherwise = checkBoards' xs nums acc +-- same thing but checks all possible numbers rather than a single slice of them checkBoards :: [Board] -> [Int] -> [(Board, Int)] checkBoards boards nums = filter (\x -> fst x /= []) solutions where solutions = [ k | i <- [1..length nums],