From 65b17a79b3e315d8e6a05c24dc0d92d2be16b9cb Mon Sep 17 00:00:00 2001 From: mmzk1526 Date: Tue, 5 Mar 2024 16:52:56 +0000 Subject: [PATCH] [mmzk] (feat) 2023 Part II `matches` --- src/Year2023/Solver.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Year2023/Solver.hs b/src/Year2023/Solver.hs index fffe2cf..2726641 100644 --- a/src/Year2023/Solver.hs +++ b/src/Year2023/Solver.hs @@ -45,11 +45,16 @@ split3M xs -- Part II matches :: String -> ParseTree -> Bool -matches - = undefined +matches clue (Synonym str) = clue `elem` synonyms str +matches clue (Anagram _ str) = sort clue == sort str +matches clue (Reversal _ tree) = matches (reverse clue) tree +matches clue (Insertion _ t1 t2) = or [ matches c1 t1 && matches c2 t2 + | (c1, c2) <- uninsert clue ] +matches clue (Charade _ t1 t2) = or [ matches c1 t1 && matches c2 t2 + | (c1, c2) <- split2 clue ] evaluate :: Parse -> Int -> [String] -evaluate +evaluate (defs, _, tree) size = undefined ------------------------------------------------------