From 38e57ca0724463c0ce5282c1b0011c6bf2b68935 Mon Sep 17 00:00:00 2001 From: Dazbo Date: Wed, 1 Jan 2025 17:08:30 +0000 Subject: [PATCH] Debug additions --- src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb b/src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb index f97ade6..eaa6355 100644 --- a/src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb +++ b/src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb @@ -9057,7 +9057,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -9589,7 +9589,7 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ @@ -9716,11 +9716,14 @@ "\n", "def find_swap_candidates(wires, operations, failures, ignore):\n", " logger.debug(\"find_swap_candidates()\")\n", + " local_wires = wires.copy()\n", " local_ops = operations.copy()\n", " local_failures = failures.copy()\n", " new_failures = local_failures.copy()\n", " swap_candidates = []\n", " \n", + " logger.debug(f\"{local_wires=}\")\n", + " logger.debug(f\"{local_ops=}\")\n", " logger.debug(f\"Initial failures: {local_failures}\")\n", " logger.debug(f\"{ignore=}\")\n", " \n", @@ -9743,14 +9746,14 @@ " # Swap these two operations and test if we can remove lowest bit failure\n", " local_ops[op_x], local_ops[op_y] = local_ops[op_y], local_ops[op_x]\n", " try:\n", - " new_failures = get_failures(wires, local_ops, local_failures)\n", + " new_failures = get_failures(local_wires, local_ops, local_failures)\n", " if not new_failures: # if we've run out of failures\n", " logger.debug(\"No failures remaining\")\n", " break\n", " \n", " if len(new_failures) < len(local_failures):\n", " local_failures = new_failures\n", - " logger.debug(f\"Failures: {local_failures}\")\n", + " logger.debug(f\"Failures reduced: {local_failures}\")\n", " swap_candidates.append(tuple(sorted((op_x, op_y))))\n", " logger.debug(swap_candidates)\n", " break # Go to next x\n", @@ -10261,7 +10264,7 @@ "toc_visible": true }, "kernelspec": { - "display_name": "aoc-conda-env", + "display_name": ".aoc-conda-env", "language": "python", "name": "python3" }, @@ -10275,7 +10278,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.2" + "version": "3.13.0" }, "toc-autonumbering": false, "toc-showcode": false,