summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Day11/app/Main.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Day11/app/Main.hs b/Day11/app/Main.hs
index 9bac5a5..163419e 100644
--- a/Day11/app/Main.hs
+++ b/Day11/app/Main.hs
@@ -218,4 +218,10 @@ monkeyBusiness = mulTwoBusiest . foldl countItemsPerActiveMonkey []
where incrementCountForMonkey :: [(MonkeyId, Int)] -> MonkeyId -> [(MonkeyId, Int)]
incrementCountForMonkey [] mid = [(mid,1)]
incrementCountForMonkey ((m, i):as) mid | m == mid = (m,i+1):as
- incrementCountForMonkey (a:as) mid = a:incrementCountForMonkey as mid \ No newline at end of file
+ incrementCountForMonkey (a:as) mid = a:incrementCountForMonkey as mid
+
+
+-- Part 2... Is a hack. It relies on the fact that all tests done by monkeys are "if foo divisible by bar", and that monkeys can only add and multiply.
+-- For addition this is true: (a%c + b%c)%c = (a+b)%c
+-- For multiplication this is true: ((a%c) * (b%c))%c = (a*b)%c
+-- The hack part is, that the same trick does not work for division... \ No newline at end of file