Skip to content

Commit

Permalink
Docs improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed-dash committed Jan 13, 2024
1 parent 719a94c commit 1d613e6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4893,13 +4893,18 @@
" # We can subst char for itself (no change), or for ?\n",
" if self.record[char_idx] in (char, \"?\"): \n",
" if char == \".\": \n",
" # we're extending the operational section or ending the damaged group\n",
" # we're either extending the operational section or ending the damaged group\n",
" if curr_group_len == 0: # we're not in a group, so we must be extending\n",
" count += self.get_arrangements_count(char_idx+1, curr_group_idx, 0)\n",
" elif (curr_group_idx < len(self.damaged_groups) \n",
" and curr_group_len == self.damaged_groups[curr_group_idx]):\n",
" elif (curr_group_idx < len(self.damaged_groups) and \n",
" curr_group_len == self.damaged_groups[curr_group_idx]):\n",
" # we're adding a . after a #, so the group is now complete; move on to next group\n",
" count += self.get_arrangements_count(char_idx+1, curr_group_idx+1, 0)\n",
" else:\n",
" # either: curr_group_len is too long\n",
" # or: we're adding . before completing a group\n",
" # Both are invalid \n",
" pass\n",
" else: # we're adding a #; extend the current group (which might be empty at this point)\n",
" count += self.get_arrangements_count(char_idx+1, curr_group_idx, curr_group_len+1)\n",
" \n",
Expand Down Expand Up @@ -4966,13 +4971,13 @@
"source": [
"%%time\n",
"sample_inputs = []\n",
"sample_inputs.append(\"\"\"???.### 1,1,3\n",
"sample_inputs.append(\"\"\"\\\n",
"???.### 1,1,3\n",
".??..??...?##. 1,1,3\n",
"?#?#?#?#?#?#?#? 1,3,1,6\n",
"????.#...#... 4,1,1\n",
"????.######..#####. 1,6,5\n",
"?###???????? 3,2,1\n",
"\"\"\")\n",
"?###???????? 3,2,1\"\"\")\n",
"sample_answers = [21]\n",
"\n",
"for curr_input, curr_ans in zip(sample_inputs, sample_answers):\n",
Expand Down

0 comments on commit 1d613e6

Please sign in to comment.