summaryrefslogtreecommitdiff
path: root/11.c
diff options
context:
space:
mode:
Diffstat (limited to '11.c')
-rw-r--r--11.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/11.c b/11.c
index 09894d8..de76e5c 100644
--- a/11.c
+++ b/11.c
@@ -95,6 +95,7 @@ main(int argc, char ** argv)
int nmonkeys = 0;
long i, j;
int calming = 3, rounds = 20;
+ unsigned long test_mod = 1;
while ((i = getopt(argc, argv, "p:c:r:")) != -1) {
switch (i) {
@@ -205,6 +206,8 @@ main(int argc, char ** argv)
free(monkeys);
return -1;
}
+
+ test_mod *= m->test_div;
}
// Perform monkey inspection rounds
@@ -242,6 +245,8 @@ main(int argc, char ** argv)
}
*item /= calming;
+ *item %= test_mod;
+
catcher = *item % m->test_div ? m->test_false : m->test_true;
monkey_additem(monkeys + catcher, *item);