Fixed typo master
authorNeil Smith <NeilNjae@users.noreply.github.com>
Wed, 22 Jun 2022 10:34:53 +0000 (11:34 +0100)
committerNeil Smith <NeilNjae@users.noreply.github.com>
Wed, 22 Jun 2022 10:34:53 +0000 (11:34 +0100)
advent19.ipynb

index f0966902fe7d5c7d1ffc9ca72b38e6d0299fd790..2288bcc79a6bbe94420aeabfd99e6fc021022e6d 100644 (file)
@@ -2,9 +2,9 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 10,
+   "execution_count": 1,
    "metadata": {
-    "collapsed": true
+    "tags": []
    },
    "outputs": [],
    "source": [
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "#Part 1"
+    "# Part 1"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 2,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [
     {
@@ -75,7 +78,7 @@
        " 'CRnSiRnCaPTiMgYCaPTiRnFArSiThFArCaSiThSiThPBCaCaSiRnSiRnTiTiMgArPBCaPMgYPTiRnFArFArCaSiRnBPMgArPRnCaPTiRnFArCaSiThCaCaFArPBCaCaPTiTiRnFArCaSiRnSiAlYSiThRnFArArCaSiRnBFArCaCaSiRnSiThCaCaCaFYCaPTiBCaSiThCaSiThPMgArSiRnCaPBFYCaCaFArCaCaCaCaSiThCaSiRnPRnFArPBSiThPRnFArSiRnMgArCaFYFArCaSiRnSiAlArTiTiTiTiTiTiTiRnPMgArPTiTiTiBSiRnSiAlArTiTiRnPMgArCaFYBPBPTiRnSiRnMgArSiThCaFArCaSiThFArPRnFArCaSiRnTiBSiThSiRnSiAlYCaFArPRnFArSiThCaFArCaCaSiThCaCaCaSiRnPRnCaFArFYPMgArCaPBCaPBSiRnFYPBCaFArCaSiAl']"
       ]
      },
-     "execution_count": 1,
+     "execution_count": 2,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 3,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [
     {
        " ['e', 'OMg']]"
       ]
      },
-     "execution_count": 2,
+     "execution_count": 3,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 4,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [
     {
        "'CRnSiRnCaPTiMgYCaPTiRnFArSiThFArCaSiThSiThPBCaCaSiRnSiRnTiTiMgArPBCaPMgYPTiRnFArFArCaSiRnBPMgArPRnCaPTiRnFArCaSiThCaCaFArPBCaCaPTiTiRnFArCaSiRnSiAlYSiThRnFArArCaSiRnBFArCaCaSiRnSiThCaCaCaFYCaPTiBCaSiThCaSiThPMgArSiRnCaPBFYCaCaFArCaCaCaCaSiThCaSiRnPRnFArPBSiThPRnFArSiRnMgArCaFYFArCaSiRnSiAlArTiTiTiTiTiTiTiRnPMgArPTiTiTiBSiRnSiAlArTiTiRnPMgArCaFYBPBPTiRnSiRnMgArSiThCaFArCaSiThFArPRnFArCaSiRnTiBSiThSiRnSiAlYCaFArPRnFArSiThCaFArCaCaSiThCaCaCaSiRnPRnCaFArFYPMgArCaPBCaPBSiRnFYPBCaFArCaSiAl'"
       ]
      },
-     "execution_count": 8,
+     "execution_count": 4,
      "metadata": {},
      "output_type": "execute_result"
     }
    "cell_type": "code",
    "execution_count": 5,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [
     {
   },
   {
    "cell_type": "code",
-   "execution_count": 18,
+   "execution_count": 7,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [],
    "source": [
     "transformed = set([])\n",
     "for r in rules:\n",
-    "    for m in re.finditer(r[0], target):\n",
+    "    for m in re.finditer(r[0], base):\n",
     "        t = base[:m.start(0)] + r[1] + base[m.end(0):]\n",
     "        # print(t, m.start(0), m.end(0))\n",
     "        transformed.update([t])"
   },
   {
    "cell_type": "code",
-   "execution_count": 19,
+   "execution_count": 8,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [
     {
        "518"
       ]
      },
-     "execution_count": 19,
+     "execution_count": 8,
      "metadata": {},
      "output_type": "execute_result"
     }
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "#Part 2"
+    "# Part 2"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 48,
+   "execution_count": 9,
    "metadata": {
-    "collapsed": true
+    "tags": []
    },
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 76,
+   "execution_count": 14,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [],
    "source": [
     "#This is infeasible\n",
     "\n",
-    "#agenda = [(base, 0)]\n",
-    "#closed_set = set()\n",
+    "# agenda = [(base, 0)]\n",
+    "# closed_set = set()\n",
     "\n",
-    "#while agenda[0][0] != 'e':\n",
+    "# while agenda[0][0] != 'e':\n",
     "#    # print(len(agenda), len(agenda[0][0]))\n",
     "#    current_m, current_c = agenda[0]\n",
     "#    if current_m in closed_set:\n",
     "#        closed_set.update(current_m)\n",
     "#        new_molecules = [(reduced, current_c + 1) for r in rules for reduced in reductions(r, current_m)]\n",
     "#        agenda = agenda[1:] + new_molecules\n",
-    "#agenda[0]"
+    "# agenda[0]"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 75,
+   "execution_count": 15,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [
     {
        "('e', 200)"
       ]
      },
-     "execution_count": 75,
+     "execution_count": 15,
      "metadata": {},
      "output_type": "execute_result"
     }
   },
   {
    "cell_type": "code",
-   "execution_count": 73,
+   "execution_count": 11,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [
     {
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "1 loops, best of 3: 281 ms per loop\n"
+      "317 ms ± 18.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
      ]
     }
    ],
   },
   {
    "cell_type": "code",
-   "execution_count": 74,
+   "execution_count": 12,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "jupyter": {
+     "outputs_hidden": false
+    }
    },
    "outputs": [
     {
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "10 loops, best of 3: 44.4 ms per loop\n"
+      "53.5 ms ± 1.11 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
      ]
     }
    ],
    "cell_type": "code",
    "execution_count": null,
    "metadata": {
-    "collapsed": true
+    "tags": []
    },
    "outputs": [],
    "source": []
  ],
  "metadata": {
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "Python 3 (ipykernel)",
    "language": "python",
    "name": "python3"
   },
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.4.3"
+   "version": "3.8.8"
   }
  },
  "nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 4
 }