Oops i forgot to update comments

This commit is contained in:
Agatha Lovelace 2021-12-04 22:49:57 +02:00
parent c2db929c35
commit 21def8762b
1 changed files with 2 additions and 1 deletions

View File

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