<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import forge\n",
    "from puzzle.puzzlepedia import puzzlepedia\n",
    "\n",
    "puzzle = puzzlepedia.parse(\"\"\"\n",
    "position in range(8 + 1)\n",
    "name in {Beth, Charles, David, Frank, Jessica, Karen, Taylor, Gordon, Nina}\n",
    "state in {CA, FL, KY, MT, NY, TX, WI, XX, ZZ}\n",
    "handed in {left, right}\n",
    "\n",
    "def dist(a, b):\n",
    "  return abs(a.position - b.position) - 1\n",
    "\n",
    "def near(a, b):\n",
    "  return abs(a.position - b.position) == 1\n",
    "\n",
    "# 0:\n",
    "Gordon[0] == True\n",
    "Gordon == right\n",
    "Gordon == XX\n",
    "# NB: 5 is a different seat in the book.\n",
    "Nina[5] == True\n",
    "Nina == right\n",
    "Nina == ZZ\n",
    "\n",
    "# 1a: two left handed people sitting in the corners.\n",
    "left[1] == True\n",
    "left[6] == True\n",
    "all(right[i] for i in [0, 2, 3, 4, 5, 7, 8])\n",
    "\n",
    "# 2: Montana is next to Florida and Wisconson.\n",
    "near(MT, FL)\n",
    "near(MT, WI)\n",
    "# ...and are both right handed.\n",
    "FL == right\n",
    "WI == right\n",
    "\n",
    "# 3a: Taylor is not from MT\n",
    "Taylor != MT\n",
    "Taylor != CA\n",
    "# 3b: And everyone is right handed.\n",
    "Taylor == Right\n",
    "MT == right\n",
    "CA == right\n",
    "\n",
    "# 4a: Frank and Jessica are right handed.\n",
    "Frank == right\n",
    "Jessica == right\n",
    "# 4b: ...and sit on opposite sides of the table.\n",
    "if Frank.position < 5:\n",
    "  Jessica.position > 5\n",
    "else:\n",
    "  Jessica.position < 5\n",
    "\n",
    "# 5: NY is right handed\n",
    "NY == right\n",
    "\n",
    "# 6a: Charles and FL are near the left-handed guests\n",
    "Charles != FL\n",
    "Charles[2] or Charles[7]\n",
    "FL[2] or FL[7]\n",
    "\n",
    "# 7: Frank and CA are next to Montagues.\n",
    "Frank != CA\n",
    "Frank[1] or Frank[4] or Frank[6] or Frank[8]\n",
    "CA[1] or CA[4] or CA[6] or CA[8]\n",
    "\n",
    "# 8a: Beth is on same side as TX\n",
    "Beth != TX\n",
    "if Beth.position < 5:\n",
    "  TX.position < 5\n",
    "else:\n",
    "  TX.position > 5\n",
    "\n",
    "# 8b: ...who is not Karen\n",
    "Karen != TX\n",
    "\"\"\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {<commit_msg>Sync mystery island(?) notebook edits.<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "025ed5ace5b2400b9c4b37aeeaf3931e",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Accordion(children=(VBox(children=(HBox(children=(Dropdown(options={'LogicProblem': LogicProblem('#1', ['posit…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import forge\n",
    "from puzzle.puzzlepedia import puzzlepedia\n",
    "\n",
    "puzzle = puzzlepedia.parse(\"\"\"\n",
    "position in range(8 + 1)\n",
    "name in {Beth, Charles, David, Frank, Jessica, Karen, Taylor, Gordon, Nina}\n",
    "state in {CA, FL, KY, MT, NY, TX, WI, XX, ZZ}\n",
    "handed in {left, right}\n",
    "\n",
    "def dist(a, b):\n",
    "  return abs(a.position - b.position) - 1\n",
    "\n",
    "def near(a, b):\n",
    "  return abs(a.position - b.position) == 1\n",
    "\n",
    "# 0:\n",
    "Gordon[0] == True\n",
    "Gordon == right\n",
    "Gordon == XX\n",
    "# NB: 5 is a different seat in the book.\n",
    "Nina[5] == True\n",
    "Nina == right\n",
    "Nina == ZZ\n",
    "\n",
    "# 1a: two left handed people sitting in the corners.\n",
    "left[1] == True\n",
    "left[6] == True\n",
    "all(right[i] for i in [0, 2, 3, 4, 5, 7, 8])\n",
    "\n",
    "# 2: Montana is next to Florida and Wisconson.\n",
    "near(MT, FL)\n",
    "near(MT, WI)\n",
    "# ...and are both right handed.\n",
    "FL == right\n",
    "WI == right\n",
    "\n",
    "# 3a: Taylor is not from MT\n",
    "Taylor != MT\n",
    "Taylor != CA\n",
    "# 3b: And everyone is right handed.\n",
    "Taylor == Right\n",
    "MT == right\n",
    "CA == right\n",
    "\n",
    "# 4a: Frank and Jessica are right handed.\n",
    "Frank == right\n",
    "Jessica == right\n",
    "# 4b: ...and sit on opposite sides of the table.\n",
    "if Frank.position < 5:\n",
    "  Jessica.position > 5\n",
    "else:\n",
    "  Jessica.position < 5\n",
    "\n",
    "# 5: NY is right handed\n",
    "NY == right\n",
    "\n",
    "# 6a: Charles and FL are near the left-handed guests\n",
    "Charles != FL\n",
    "Charles[2] or Charles[7]\n",
    "FL[2] or FL[7]\n",
    "\n",
    "# 7: Frank and CA are next to Montagues.\n",
    "Frank != CA\n",
    "Frank[1] or Frank[4] or Frank[6] or Frank[8]\n",
    "CA[1] or CA[4] or CA[6] or CA[8]\n",
    "\n",
    "# 8a: Beth is on same side as TX\n",
    "Beth != TX\n",
    "if Beth.position < 5:\n",
    "  TX.position < 5\n",
    "else:\n",
    "  TX.position > 5\n",
    "\n",
    "# 8b: ...who is not Karen\n",
    "Karen != TX\n",
    "\"\"\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "fabd78b6e5c647ebb67761e6b116ec9c",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Accordion(children=(VBox(children=(HBox(children=(Dropdown(options={'LogicProblem': LogicProblem('#1', ['value…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import forge\n",
    "from puzzle.puzzlepedia import puzzlepedia\n",
    "\n",
    "puzzle = puzzlepedia.parse(\"\"\"\n",
    "value in range(1, 14)\n",
    "name in {A, B, C, D, E, F, G, H, I, J, K, L, M}\n",
    "\n",
    "J.value * M.value == 18\n",
    "A.value * B.value * L.value == 48\n",
    "\n",
    "A.value + G.value + M.value == 11\n",
    "C.value + D.value + E.value == 32\n",
    "C.value + F.value + I.value + L.value == 30\n",
    "B.value + E.value + H.value + K.value == 29\n",
    "B.value + H.value + I.value + M.value == 17\n",
    "E.value + F.value + G.value + H.value + M.value == 39\n",
    "\"\"\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
{'fraction_non_alphanumeric': 0.23074700187834127, 'fraction_numerical': 0.022973558734286952, 'mean_word_length': 2.1810661764705883, 'pattern_counts': {'":': 57, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5918020', 'n_tokens_mistral': 2947, 'n_tokens_neox': 2811, 'n_words': 676}