Skip to content

Commit

Permalink
Debug additions
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed-dash committed Jan 1, 2025
1 parent 9e0c7fa commit 38e57ca
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9057,7 +9057,7 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -9589,7 +9589,7 @@
},
{
"cell_type": "code",
"execution_count": 70,
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -10261,7 +10264,7 @@
"toc_visible": true
},
"kernelspec": {
"display_name": "aoc-conda-env",
"display_name": ".aoc-conda-env",
"language": "python",
"name": "python3"
},
Expand All @@ -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,
Expand Down

0 comments on commit 38e57ca

Please sign in to comment.