Skip to content

Commit

Permalink
Day 13: clean output
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamatti committed Dec 14, 2023
1 parent f93fa7e commit 847fc45
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/day_13.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,10 @@
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'is_horisontal_mirror' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[8], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m part_2 \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, grid \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(grids):\n\u001b[0;32m----> 3\u001b[0m part_2 \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[43mflip_until_found\u001b[49m\u001b[43m(\u001b[49m\u001b[43mgrid\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mreflection_points\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mSolution: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mpart_2\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m part_2 \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m32312\u001b[39m\n",
"Cell \u001b[0;32mIn[7], line 5\u001b[0m, in \u001b[0;36mflip_until_found\u001b[0;34m(grid, disallowed_value)\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;28mlen\u001b[39m(grid[y])):\n\u001b[1;32m 4\u001b[0m new_grid \u001b[38;5;241m=\u001b[39m flip(y, x, grid)\n\u001b[0;32m----> 5\u001b[0m potential_reflection_point \u001b[38;5;241m=\u001b[39m \u001b[43mfind_reflection_point_part_2\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnew_grid\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdisallowed_value\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m potential_reflection_point \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m potential_reflection_point\n",
"Cell \u001b[0;32mIn[6], line 3\u001b[0m, in \u001b[0;36mfind_reflection_point_part_2\u001b[0;34m(grid, disallowed_value)\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mfind_reflection_point_part_2\u001b[39m(grid, disallowed_value):\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m y \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;241m1\u001b[39m, \u001b[38;5;28mlen\u001b[39m(grid)):\n\u001b[0;32m----> 3\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43mis_horisontal_mirror\u001b[49m(grid, y):\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m y \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m100\u001b[39m \u001b[38;5;241m==\u001b[39m disallowed_value:\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n",
"\u001b[0;31mNameError\u001b[0m: name 'is_horisontal_mirror' is not defined"
"name": "stdout",
"output_type": "stream",
"text": [
"Solution: 32312\n"
]
}
],
Expand Down

0 comments on commit 847fc45

Please sign in to comment.