diff --git a/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb b/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb index 4f45afe..c076414 100644 --- a/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb +++ b/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb @@ -4861,8 +4861,9 @@ " @cache # to cache, our SpringRecord must be immutable - hence frozen\n", " def get_arrangements_count(self, char_idx: int, curr_group_idx: int, curr_group_len: int):\n", " \"\"\" Determine how many arrangements are possible by recursing.\n", - " Move through the record one char at a time. Whenever we reach the end of the record,\n", - " check if it has completed all the groups.\n", + " Move through the record one char at a time. \n", + " Each recursive call depth adds one to the char_idx.\n", + " Whenever we reach the end of the record, check if it has completed all the groups.\n", " Our inputs represent a minimal state that defines where we are in the record, \n", " which group we're processing, and the length the current group.\n", "\n", @@ -4887,8 +4888,9 @@ " else: # we have not completed all groups, or current group length is too long\n", " return 0 # invalid\n", " \n", - " # Process the current char in the record by recursion\n", - " # Determine valid states for recursion\n", + " # Process from left to right\n", + " # If we're not at the end, process the current char in the record by recursion\n", + " # Determine valid states for recursion by trying . and # at the current char idx\n", " for char in [\".\", \"#\"]:\n", " # We can subst char for itself (no change), or for ?\n", " if self.record[char_idx] in (char, \"?\"): \n",