Last active
July 30, 2019 01:36
-
-
Save jkozma/73442474b7a4dcfc4081aae09e521f6c to your computer and use it in GitHub Desktop.
Digital jigsaw puzzle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## A Digital Jigsaw" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This program uses a recursive function to solve a \"digital\" jigsaw puzzle. The puzzle is digital in two distinct ways. First, obviously, it is presented here by means of digital information technology. Before considering the second way this is a digital puzzle, however, it may be noted that the original puzzle, from which this was copied, is not implemented on a computer, but with wooden pieces that must be arranged to fit in the recessed area of a wooden board. The next few sections of code use numpy arrays and matplotlib.pyplot to show what the board and pieces look like." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np\n", | |
"import matplotlib.pyplot as plt\n", | |
"from IPython.display import clear_output\n", | |
"\n", | |
"def board_figure():\n", | |
" # create coordinate axis for drawing figure\n", | |
" fig, ax = plt.subplots(figsize=(9,9))\n", | |
" \n", | |
" # Create a black border with angular edges\n", | |
" x_border = [-1,-.2,-1.4,-.3,-1,2.2,5.8,8.7,12,11.1,12.4,11.2,12,8.1,4.8,2.1,-1]\n", | |
" y_border = [-1,2.4,5.7,8.1,12,11.4,12.1,11.3,12,8.7,6.1,2.3,-1,-.4,-1.3,-.1,-1]\n", | |
" plt.fill(x_border, y_border, facecolor=\"black\")\n", | |
" \n", | |
" # Color the board area white where pieces may be placed\n", | |
" x_bd = np.array([1,4,4,5,5,9,9,10,10,11,11,10,10,7,7,4,4,1,1,0,0,1,1])\n", | |
" y_bd = np.array([1,1,0,0,1,1,0,0,6,6,7,7,10,10,11,11,10,10,6,6,5,5,1]) \n", | |
" plt.fill(x_bd, y_bd, facecolor=\"white\")\n", | |
" \n", | |
" return fig, ax\n", | |
"\n", | |
"def show_figure(ax, title=\"Puzzle Board\"):\n", | |
" ax.set_title(title)\n", | |
" plt.axis('equal')\n", | |
" plt.axis('off')\n", | |
" \n", | |
" plt.show()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhsAAAIYCAYAAADEsy4TAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XewbWd53/Hvo4oaQg1hGUkgULEEEhJIdMc2xg42trGNsU3AxsENg3EoSSaOG5PEzkzixDNxJmHiSeJxwTgkdARqCJCQaKpWQQ2Ji3qvV/U++WOtw9nn3FP22Xut/a7y/czcAe49Z++fj9c993ee913visxEkiSpLbuUDiBJkobNsiFJklpl2ZAkSa2ybEiSpFZZNiRJUqssG5IkqVWWDUlTiYj/HRH/tnSOWUTEuRHxq6VzSGNl2ZB6LCJujIjtEfFQRNweEf8rIvYtnWu1iMiIeLjOeVdEfCginlE6l6TFsGxI/fcTmbkvcApwKvB7hfOs56Q651HAAcAfNf0GEbFb068paX6WDWkgMvNm4HTgBfDdqccPL/15RPxRRPx1/d//vJ4yLP16sv7zn1/1+49FxLlrvV9EvD4iLomI+yLiyxFx4pQ5HwA+ARw/8VqHRcQnIuKeiLguIn5t4s9Oi4gL6ve5tc6+x8SfZ0S8MyKuBa6tf++1EXF1RNwfEX8OxNRfSEmNs2xIAxERhwM/Bly82cdm5rsyc9960vAq4F7g45n54YnfPwy4AfjQGu91CvA/gd8ADgI+CHwiIvacIucBwBuACyd++0PAd+r3fCPwxxHxmvrPngLeAxwMvBx4DfBbq172DcBLgeMj4mDg/1JNeA4Grgd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JUqssG5IkqVWWDUmS1CrLhiRJapVlQ5IktcqyIUmSWmXZkCRJrbJsSJKkVlk2JElSqywbkiSpVZYNSZLUKsuGJElqlWVDkiS1yrIhSZJaZdmQJEmtsmxIkqRWWTYkSVKrLBuSJKlVlg1JktQqy4YkSWqVZUOSJLXKsiFJklpl2ZAkSa2ybEiSpFZZNiRJUqssG5IkqVX/H4RUgqrxgcFGAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 648x648 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Display the empty board\n", | |
"fig, ax = board_figure()\n", | |
"show_figure(ax)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"The use of numpy arrays makes it easier to write code for various operations like flipping and rotating the pieces and placing them on the board. In the declaration for the pieces, each piece is represented by an array in which zero is empty space. A different value and corresponding color is assigned to each piece, allowing them to be distinguished from one another after they have been placed on the board." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# color keys: 0 for empty squares, 1 for puzzle border\n", | |
"# 1.0x for pieces, where x is unique for each piece\n", | |
"# 10 for marker\n", | |
"colors = {0:'white',1:'black',\n", | |
" 1.01:'#909090',1.02:'#a0a0a0',1.06:'#c0c0c0',\n", | |
" 1.04:'#99754b',1.03:'#707070',1.05:'#332719',\n", | |
" 1.09:'#ffc77e',1.08:'#cc9c64',1.07:'#664e32',\n", | |
" 10:'red'}\n", | |
"\n", | |
"pieces = [\n", | |
" np.array([\n", | |
" [0,1,1,1],\n", | |
" [1,1,1,1],\n", | |
" [0,0,1,1]])*1.01,\n", | |
" np.array([\n", | |
" [1,0,1,0],\n", | |
" [1,1,1,1],\n", | |
" [1,1,1,0]])*1.02,\n", | |
" np.array([\n", | |
" [0,1,1,1],\n", | |
" [1,1,1,0],\n", | |
" [1,1,1,0]])*1.03,\n", | |
" np.array([\n", | |
" [1,0,1,0],\n", | |
" [1,1,1,0],\n", | |
" [1,1,1,1]])*1.04,\n", | |
" np.array([\n", | |
" [0,1,0,0],\n", | |
" [1,1,1,0],\n", | |
" [0,1,1,1],\n", | |
" [1,1,1,0]])*1.05,\n", | |
" np.array([\n", | |
" [0,1,0,1],\n", | |
" [0,1,1,1],\n", | |
" [1,1,1,0]])*1.06,\n", | |
" np.array([\n", | |
" [0,1,0,0],\n", | |
" [0,1,1,0],\n", | |
" [0,1,1,1],\n", | |
" [1,1,1,1],\n", | |
" [0,1,0,0]])*1.07,\n", | |
" np.array([\n", | |
" [0,1,0,0],\n", | |
" [1,1,1,0],\n", | |
" [1,1,1,0],\n", | |
" [1,1,1,1],\n", | |
" [1,0,0,0]])*1.08,\n", | |
" np.array([\n", | |
" [0,0,1,0],\n", | |
" [0,1,1,1],\n", | |
" [0,1,1,0],\n", | |
" [1,1,1,1],\n", | |
" [0,1,0,0]])*1.09\n", | |
" ]\n", | |
"\n", | |
"def add_piece(p, x0=0, y0=0, invert_y=True, y_top=None):\n", | |
" if invert_y:\n", | |
" y_offset = len(p)\n", | |
" else:\n", | |
" y_offset = 1\n", | |
" xx0 = np.array([x0, x0+1, x0+1, x0, x0])\n", | |
" yy0 = np.array([y0, y0, y0-1, y0-1, y0])\n", | |
" for x in range(len(p[0])):\n", | |
" for y in range(len(p)):\n", | |
" xx = xx0 + np.full(5,x)\n", | |
" yy = yy0 + np.full(5,y_offset-y)\n", | |
" color = colors[p[y,x]]\n", | |
" if p[y,x] == 0:\n", | |
" a = 0\n", | |
" else:\n", | |
" a = 0.6\n", | |
" if y_top:\n", | |
" yy = y_top + yy - y_offset\n", | |
" plt.fill(xx, yy, color, alpha=a)\n", | |
" return\n", | |
"\n", | |
"def add_pieces(pp):\n", | |
" x = [0,6,12,0,6,12,0,6,12]\n", | |
" y = [0,0,0,6,6,6,12,12,12]\n", | |
" for i in range(len(pp)):\n", | |
" add_piece(pp[i],x[i],y[i])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmIAAAJOCAYAAAAUOGurAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAADyRJREFUeJzt3E+opeddwPHfEy/YgqVFLa0jJQtdRKsLnYiDm6ELF5WUCYJbL5imtwt1HApBqxBm4cKCDHcheBNnMRhQpFAi0finBQdBBswgiJCAFERpqAut/SMuYn1dzA0MQUvoZM535p7PBwbmnnfOfX/vvc97+PLcc2dt2zYAAOzeI/UAAAD7SogBAESEGABARIgBAESEGABARIgBAESEGPDQWmu9vNY6rOcA+HYt/48Y8KBba/3TzHxgZr45M/85M386M7+0bds3yrkA7pUdMeBh8bFt275rZn58Zn5iZn4jngfgngkx4KGybduXZublmfmRtdZfrbU+/uaxtdYvrLVeXWt9Za3152utR+869uG11l+utf59rfWva61Pnz7+yFrrV9daX1xr/dta64/WWt99euxda60XTh//j7XW3661PrDrawbOLiEGPFTWWh+amZ+Zmb97y+NPzsynZ+ZnZ+b9M/PXM/MHp8feMzOfn5k/m5lzM/ODM/OF06f+8sw8OTMXT499ZWZ+5/TY4cy8d2Y+NDPfMzOfnJn/uj9XBuwj7xEDHnin7xH73pn575n56sz8ycx8au7sjL2wbdvvrbVenpnPbtt2/fQ5j8zMN2bmh2bmp2bmmW3bfuz/+Nyvzswvbtv2hdOPv29m/nlm3j0zPz8zH5+ZT27b9vf39SKBvXRQDwDwNj25bdvn735grXX3h4/OzPFa67fv/icz8/1zZ0fri//P5310Zj631vqfux775tz55YDfP33uH6613jczL8zMr2/b9sa9XAjAm/xoEjgr/mVmjrZte99df969bdvfnB77gW/xvI++5Xnv2rbtS9u2vbFt29Vt23547uyqPTF3dskA3hFCDDgrfndmfm2t9eGZmbXWe9daP3d67KWZ+eBa61fWWt+51nrPWusn73reb775xv611vvXWpdO//6RtdaPrrW+Y2a+NjNvzJ3dMoB3hBADzoRt2z43M781d36M+LWZ+YeZ+ejpsa/PzE/PzMdm5ssz848z85HTpx7PzB/PzF+stb4+M7dm5s1I++DMfHbuRNirM3Nz7vx4EuAd4c36AAARO2IAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAABEhBgAQEWIAAJGDegDuzdGl8ye7PufJi7ePdn1Ozp7b15/e+do9/9Tz1i4Pn1vP7vxemQtX3Ss7YkcMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAImvbtnoG7sHRpfMn9Qy7cPLi7aN6hrPq9vWn92INVc4/9by1e5bcetb9cr9cuLqX94odMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgIMQCAiBADAIgc1APA23F06fzJrs958uLto12fE+CBcOGq178dsSMGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAkYN6gLPk6NL5k3oG4MFy+/rTO39dOP/U80e7Pmfi1rNec++X4mt74ep+rNu3sCMGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAESEGABARYgAAkbVtWz0D9+Do0vmTXZ/z5MXbR7s+J/fP7etP73wNzcycf+p564iHz61nd3+/XLjqXjnD7IgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABAZG3bVs8AALCX7IgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAEQO6gGA/fT4Y+dOdn3OV157/WjX5wT4VuyIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQGRt21bPcGY898wTJ7s+5yc+89LRrs+5L9e5Lx5/7NzOv5/75JXXXrd2z5CbN2/u/H65ePHiztfQvlzng8COGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABARIgBAESEGABA5KAegHvz3DNPnNQz8HB75bXXj4rzPv7Yub1Yu8V1Vt9T7o+bN2/uxb2yr+yIAQBEhBgAQESIAQBEhBgAQES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IAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQOSgHuAsOT4+PqlngIfFjRs39uJ+Ka7z8PDwaNfnLFy5cmUv1lDh2rVre7GGHgR2xAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACAixAAAIkIMACByUA9wlly+fPmonmEXjo+PT+oZ4GFxeHi4F68LwLfHjhgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBE1rZt9QwAAHvJjhgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBEhBgAQESIAQBE/hcZNkvBdOYkeQAAAABJRU5ErkJggg==\n", | |
"text/plain": [ | |
"<Figure size 720x720 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Display the pieces\n", | |
"fig, ax = plt.subplots(figsize=(10,10))\n", | |
"add_pieces(pieces)\n", | |
"show_figure(ax,\"Pieces\")" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Even though they can be rotated or flipped, it's pretty easy to see that there are only eight possible orientations for each piece. That is, in essence, the second way in which this is a digital puzzle. In a conventional jigsaw puzzle, a piece might be rotated by any arbitrary amount to fit into its correct position. The pieces here have square corners and can only be rotated 90 degrees at a time, \"facing\" left, right, up or down on either side. " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def generate_orientations(piece, fn=True):\n", | |
" piece_orientations = [(0, piece.copy())]\n", | |
" for i in [0, 1, 2]:\n", | |
" piece_orientations.append((i+1,np.rot90(piece_orientations[i][1])))\n", | |
" piece_orientations.append((4,piece.transpose()))\n", | |
" for i in [4, 5, 6]:\n", | |
" piece_orientations.append((i+1,np.rot90(piece_orientations[i][1])))\n", | |
" if fn:\n", | |
" return iter(piece_orientations)\n", | |
" else:\n", | |
" lst_rtn = []\n", | |
" for i in range(8):\n", | |
" lst_rtn.append(piece_orientations[i][1])\n", | |
" return lst_rtn" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAJOCAYAAACTCYKtAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAEuxJREFUeJzt3H/oZXldx/HXO7/mz/JHWrimaxlJRSYSZBEZWWQ1kQT9IiXLnPEfwTAnDCslam2QKPpBM0VSrlnZL2r6pWkqtSVEFBX90lI313LVXc1SUfv0xz2TX4f57n7Z17R33Hk84LIz99xzzufcc2fmuZ9zvnfWWgEA4I75uH0PAADgY5mYAgAoiCkAgIKYAgAoiCkAgIKYAgAoiCm4C5iZ752Zn9v3OJJkZh4+M++dmbvdifu818z8zsy8e2Zefmft9//blXRegaON75mCK8vMPDXJs5M8Msl7kvxmkueutW69E/b9iCT/muTua60PHXOdNyX5zrXWH/3/jex2x/CUJM9M8kXHHTfA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YuDqdPHP+1L727XPPvvjccyUwMwUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUBBTAAAFMQUAUDjY9wC46zh3+sTZfe7/5Jnzp/a5/33b9/sP3Ln2/Xeev3M+wswUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBBTAEAFMQUAEBh1lr7HgMAwMcsM1MAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAAUxBQBQEFMAAIX/BQvRkS3jCtDjAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 720x720 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Display all possible orientations for a piece\n", | |
"fig, ax = plt.subplots(figsize=(10,10))\n", | |
"add_pieces(generate_orientations(pieces[3], fn=False))\n", | |
"show_figure(ax, \"Orientations for one piece\")" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Assuming there's a way to specify the order in which the pieces have been placed in the puzzle, it should thus be possible to find the solution by trying every possible combination of orientations for each possible sequence of pieces.\n", | |
"\n", | |
"How many possibilities are there? Since each piece has eight possible orientations, for any given order of nine pieces there will be 8<sup>9</sup>, or 134,217,728 possible combinations. The number of different orders for nine pieces is given by 9 factorial, or 362,880, so the total number of possibilities, 9! x 8<sup>9</sup>, is 48,704,929,136,640. The computer on which these notes are being written has a 2.6 GHz processor. Assuming it could check one possible solution per clock cycle, it would take 48,704,929,136,640 / 2,600,000,000, or about 18,733 seconds to go through them all. That's a little more than two days.\n", | |
"\n", | |
"Fortunately, it's not necessary to check every possible sequence. It will often be obvious after placing just one or two pieces that there'd be no way the rest will fit. Before considering how to design an algorithm that will effectively prune the search tree, however, the ordering of pieces that have been placed on the board must be clearly defined. A simple scheme is to look at the squares in the puzzle row by row, left to right. Since all the squares on the board would have to be filled by a correct solution, the first piece in the solution would have to fill the first square on the board." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"bd = np.array([[1,1,1,1,0,0,0,1,1,1,1],\n", | |
" [1,0,0,0,0,0,0,0,0,0,1],\n", | |
" [1,0,0,0,0,0,0,0,0,0,1],\n", | |
" [1,0,0,0,0,0,0,0,0,0,1],\n", | |
" [1,0,0,0,0,0,0,0,0,0,0],\n", | |
" [0,0,0,0,0,0,0,0,0,0,1],\n", | |
" [1,0,0,0,0,0,0,0,0,0,1],\n", | |
" [1,0,0,0,0,0,0,0,0,0,1],\n", | |
" [1,0,0,0,0,0,0,0,0,0,1],\n", | |
" [1,0,0,0,0,0,0,0,0,0,1],\n", | |
" [1,1,1,1,0,1,1,1,1,0,1]])\n", | |
"\n", | |
"def locat(xy_array, val=0, test_equal=True):\n", | |
" # return the x, y indices of the first element in the array\n", | |
" # that meets the specified condition\n", | |
" # first value in return tuple is the left-right index,\n", | |
" # second return value is top-bottom index \n", | |
" try:\n", | |
" if test_equal:\n", | |
" return next(zip(np.where(xy_array==val)[1],np.where(xy_array==val)[0]))\n", | |
" else:\n", | |
" return next(zip(np.where(xy_array>=val)[1],np.where(xy_array>=val)[0]))\n", | |
" except:\n", | |
" return (-1, -1)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhsAAAIYCAYAAADEsy4TAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XmQZWd55/nvow0tCO0SCC0gQBISSAiQ2Gm7saHBYLuNDW4bMB5s2hjaNosnZnqx8TIzf/Q47JjwTJiYnmkzNmBo2ohFgEorQkKAQGhBC9qQVNoXtO9SPfPHOUnezMrlZt5z7nuW7yeiAqmUde+vklNZv3ze97wnMhNJkqS27FA6gCRJGjbLhiRJapVlQ5IktcqyIUmSWmXZkCRJrbJsSJKkVlk2pA6JiMMi4sGI2LF0FklqimVDKiAiro+IR+pisfDj4My8MTOfnplPbeI13xsR57aRdzMiIiPi+aVzSCrPsiGV87a6WCz8uGWtD46Kf2bnJCJ2Kp1BGgq/cEkdEhHPqScCO9X/fnZE/C8RcR7wMHBEPcG4LiIeiIgfR8RvRsQLgb8DXlVPSe5d5fX3ioj/JyJujYibI+IvF5Zs6tc9LyL+OiLurd/j1fXPb42IOyLityZe6+8j4u8i4rQ6yzci4vD6v51Tf9jFdZ53RsQPI+JtE79+54i4KyJeskLO/SPiK3WOn0TENxeKVkScEBEX1u/52Yj4p4j4y4nfw7nLXuunE5aI+IWI+EFE3F//nj6+wuf+fRFxI3Bm/fOvjIhv1Vkujoif2cj/p5IsG1IfvBt4P7AncCfwfwBvzsw9gVcDF2XmFcDvAefXU5K9V3mtTwJPAs8HTgDeCPzOxH9/BXAJsB/waeCfgBPrj38X8LcR8fSJj/9N4C+A/YGLgE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73c9CZpOpYNqSciYhfgHVT7Ol5SOM5GPQZ8k8WCcWlmbisbSdK8WDaknqn3dfwM1b6Ot5ZNs6bLWCwX57gXShovy4bUYxFxFNW+jvcy3W72Nt1FdQ7NFuC0zLy5cB5JHWHZkAYgIvYHfg/4EHDQnN72CeBcFqcXF7k0Imkllg1pQCLiacC/oVpieXELb3EFi+XiG5n5UAvvIWlgLBvSANX7Ot5AVTrePMNL/YSlSyNbG4gnaWQsG9LARcSxVPs63g08bZ0PfxI4j8XpxQ98wKCkWVk2pJGIiAOBDwAfBA6Y+E9XURWLU6mWRh4oEE/SgFk2pJGJiF2B36R6xP1pmXl92USShs6yIUmSWrVD6QCSJGnYLBuSJKlVlg1JktQqy4YkSWqVZUOSJLXKsiFJklpl2ZAkSa2ybEiSpFZZNiRJUqssG5IkqVWWDUmS1CrLhiRJapVlQ5IktcqyIUmSWmXZkCRJrbJsSJKkVlk2JElSqywbkiSpVZYNSZLUKsuGJElqlWVDkiS1yrIhSZJaZdmQJEmtsmxIkqRWWTYkSVKrLBuSJKlVlg1JktQqy4YkSWqVZUOSJLXKsiFJklpl2ZAkSa2ybEiSpFZZNiRJUqssG5IkqVWWDUmS1CrLhiRJapVlQ5IktcqyIUmSWmXZkCRJrbJsSJKkVlk2JElSqywbkiSpVZYNSZLUKsuGJElqlWVDkiS16v8Hr4ARFejwWEQAAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 648x648 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Show the first square on the board\n", | |
"marker = np.array([[10]])\n", | |
"fig, ax = board_figure()\n", | |
"x, y = locat(bd)\n", | |
"add_piece(marker, x, y, y_top=11)\n", | |
"show_figure(ax, \"First empty square\")" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"It is also clear that for a given orientation of any piece to be the first piece in a solution, the \"first\" non-empty square in that piece must fill the first empty square on the board." | |
] |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
"text/plain": [ | |
"<Figure size 720x720 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Show the first square for all possible orientations of a piece\n", | |
"import copy\n", | |
"marked_orientations = copy.deepcopy(generate_orientations(pieces[6], fn=False))\n", | |
"for pp in marked_orientations:\n", | |
" y, x = locat(pp, val=1, test_equal=False)\n", | |
" pp[x][y] = 10\n", | |
"fig, ax = plt.subplots(figsize=(10,10))\n", | |
"add_pieces(marked_orientations)\n", | |
"show_figure(ax, \"First square for orientations of one piece\")" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"If a piece in a given orientation will not fit in the first position on the board, then any potential solutions with that piece in that orientation can be eliminated from consideration." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhsAAAIYCAYAAADEsy4TAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XmYdGV95//3l31HdkUWBQQFRXEBF3BM1CQmmJhxTeJCYkxi1ETFyfyy64yZ/OaacaITZ65xkplf3KMxERVR2QQCsimyiOwIPuw7sjysz/f3xzltV/fTS1VXnbpPnfN+XVdfLNVd9anq092fuu/73CcyE0mSpKZsUjqAJEnqNsuGJElqlGVDkiQ1yrIhSZIaZdmQJEmNsmxIkqRGWTYEQER8IyLeNsXHOyoirpjSY+0TEfdHxKbTeLzVTPO1jojrIuIV03isEo/XtIj41YhYVx8/h0XEpRHxshG+fqTPX/S1L4mIq+rHfs20f0bHNczPXX37ftPMpTLCfTb6IyKuA/YAHgceAE4A3pOZ95fMNUsi4jTgM5n590N+/geBAzLzzU3m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4Vg2pBkREVsAb6Ba1/GcwnFG9TDwr8wXjEsyc0PZSJKmxbIhzZh6XcfLqNZ1HF02zYouZb5cnOFaKKm/LBvSDIuIg6jWdRzDcKvZm3QH1T40JwInZeaNhfNIagnLhtQBEbEr8HvAu4E9pvSwjwJnMj96caFTI5KWYtmQOiQitgR+jWqK5VkNPMRlzJeL0zPzgQYeQ1LHWDakDqrXdbycqnS8aoy7uouFUyPrJhBPUs9YNqSOi4hDqNZ1vAXYcpVPfww4i/nRi+97gUFJ47JsSD0REbsD7wTeBew2cNOVVMXiW1RTI/cViCepwywbUs9ExFbAb1Bd4v6kzLyubCJJXWfZkCRJjdqkdABJktRtlg1JktQoy4YkSWqUZUOSJDXKsiFJkhpl2ZAkSY2ybEiSpEZZNiRJUqMsG5IkqVGWDUmS1CjLhiRJapRlQ5IkNcqyIUmSGmXZkCRJjbJsSJKkRlk2JElSoywbkiSpUZYNSZLUKMuGJElqlGVDkiQ1yrIhSZIaZdmQJEmNsmxIkqRGWTYkSVKjLBuSJKlRlg1JktQoy4YkSWqUZUOSJDXKsiFJkhpl2ZAkSY2ybEiSpEZZNiRJUqMsG5IkqVGWDUmS1CjLhiRJapRlQ5IkNcqyIUmSGmXZkCRJjbJsSJKkRlk2JElSoywbkiSpUZYNSZLUKMuGJElqlGVDkiQ1yrIhSZIa9f8D0fjbQ3DqMFYAAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 648x648 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Show an orientation of a piece that cannot be placed first on the board\n", | |
"fig, ax = board_figure()\n", | |
"wrong_piece = generate_orientations(pieces[3], fn=False)[2]\n", | |
"x, y = locat(bd)\n", | |
"add_piece(wrong_piece, x, y, y_top=11)\n", | |
"show_figure(ax, \"Piece in orientation that does not fit in first position\")" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"On the other hand, if a piece in a given orientation can be placed in the first available position, the board with the piece thus placed can be viewed as a new problem in which one of the remaining pieces must next be placed in the first remaining space. This is the essence of a recursive approach to solving the puzzle. To implement a recursive algorithm, it's necessary to keep track of which pieces have been placed on the board. This can be done by adding each succesive piece to the numpy array that represents the board. However, only arrays of the same size can be added, so each piece must be padded with the correct number of zeros on each side (top, bottom, left and right) so that its first non-empty space is in the same position as the first empty space on the board." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def pad_piece(board, piece, location=None):\n", | |
" # x and y are used to make the numpy array references more readable\n", | |
" x = 0\n", | |
" y = 1\n", | |
" # determine the location where the piece will be placed\n", | |
" if location == None:\n", | |
" location = locat(board, 0)\n", | |
" # skip leading empty spaces on the top row of the piece\n", | |
" pc_offset = locat(piece,0.5,False)[x]\n", | |
" location = (location[x] - pc_offset, location[y])\n", | |
" \n", | |
" # check whether the piece is off the left side of the board\n", | |
" # note, it's not necessary to check whether the piece extends over the\n", | |
" # top of the board, since the to of the piece hast to fill the first\n", | |
" # empty space on the board\n", | |
" if location[x] < 0:\n", | |
" return (False, board)\n", | |
" \n", | |
" bd_width = len(board[x])\n", | |
" bd_height = len(board)\n", | |
" piece_width = len(piece[x])\n", | |
" piece_height = len(piece)\n", | |
"\n", | |
" # check whether the piece is off the right side of the board\n", | |
" if location[x] + piece_width > bd_width:\n", | |
" return (False, board)\n", | |
" # check whether the piece extends past the bottom of the board\n", | |
" if location[y] + piece_height > bd_height:\n", | |
" return (False, board)\n", | |
" \n", | |
" # compute the padding to locate the piece correctly\n", | |
" pad_left = location[x]\n", | |
" pad_right = bd_width - piece_width - location[x]\n", | |
" pad_top = location[y]\n", | |
" pad_bottom = bd_height - piece_height - location[y]\n", | |
" \n", | |
" pp = np.pad(piece,((pad_top,pad_bottom),(pad_left,pad_right)),'constant')\n", | |
" bd_with_piece = pp + board\n", | |
"\n", | |
" # When the piece is added to the board, any squares where the added piece\n", | |
" # overlaps with the board or a previously placed piece will have a value\n", | |
" # greater than 2\n", | |
" overlap = locat(bd_with_piece, 2, False)\n", | |
" if overlap[1] < 0:\n", | |
" return (True, bd_with_piece)\n", | |
" else:\n", | |
" return (False, board)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhsAAAIYCAYAAADEsy4TAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XmUZWd53/vvI7VmCc0DQgNIaEACgQSSmERwxGAIGMcDngCLIbYJGBuM7112nIBXHDv3xom9bm7uul7LsZ14CoQYMUNrFhICYYQGNM9qzQOa51Y/+WPvok5V13Cqzt7n3Wfv72etWqruqjr169Lp6l8977vfHZmJJElSW7YpHUCSJPWbZUOSJLXKsiFJklpl2ZAkSa2ybEiSpFZZNiRJUqssG9IMi4i/iog/mPAxfjci/nyFt58WERdM8jlGHuuUiLi2icdqS0RkRLx4mbet+2vR5NdRmjUbSgeQZllE3ALsDzwHPAt8C/i1zNxUMtdaZOYfzr0eES8Ebga2y8zNLXyubwJHNf24krrNyYY0uXdm5q7A84F7gP/c9CeICH8wkDSzLBtSQzLzKeBzwDFzvxcRu0fEf4+I+yLi1oj4vYjYpn7b4RFxdkQ8EBH3R8TfRsQeIx97S0T8nxFxOfB4RGyIiOMj4pKIeDQiPgPsuFye+vO9sn79PfXywDH1rz8UEafXr386Iv6m/rDz6/8+FBGPRcRrRh7vjyPiwYi4OSLetsLnvSUificirqrf/y8jYsf6bW+MiNtH3vfAiPhf9dfn5oj42Mjbtq2XeG6s/7zfi4iD67cdHRFnRMQPI+LaiHj3CnneHxFX149xU0T86qK3/3ZE3BURd0bEBxa9be+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 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Add a padded piece to the board and display the result\n", | |
"fit, new_bd = pad_piece(bd, pieces[0])\n", | |
"if fit:\n", | |
" fig, ax = board_figure()\n", | |
" add_piece(new_bd)\n", | |
" show_figure(ax, \"Board with piece added\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhsAAAIYCAYAAADEsy4TAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XeUZGd55/HvoxxRDgxKSCAJCQSSUAAkjC0ZjA0LBiwbTBAGYzDBJK/XXgfwOux6vcc+Z6PPOqwXDJYWGxB5lIWERBIKKIEiymEY5ax59o97m67u6VDdVbfeW/d+P+f00cz0VNVvelo9v37e9743MhNJkqSmbFI6gCRJ6jbLhiRJapRlQ5IkNcqyIUmSGmXZkCRJjbJsSJKkRlk2pIIi4v9ExJ+M+By/FxF/u8T7T46I80d5jUlb7s/UZhFxY0ScuMj7XhYRt6zyeVf9WKm0zUoHkEqKiBuBPYCngCeAbwDvzsybS+Zaicz8s5kfR8R+wA3A5pn55Gqer/6YvDMzzxhHvtUY/DNJmn5ONiR4dWZuBzwduBP4r+N+gYiw2EvqLcuGVMvMR4HPAIfM/FpE7BAR/zci7o6ImyLi9yNik/p9B0TEWRGxLiLuiYh/iogdBx57Y0T8TkRcBjwUEZtFxOERcXFEPBARpwBbLZanfr0j6x+/OSIyIg6pf/7OiPhc/eOPRcQn64edV//33oh4MCJeNPB8fxkR6yPihoh45SKv+QlgH+AL9eP/bUT8Y0R8pH7/M+ocv1n//FkR8eOIiPrnvx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ZkCRJjbJsSJKkRlk2JElSoywbkiSpUZYNSZLUKMuGJElqlGVDkiQ1yrIhSZIaZdmQJEmNsmxIkqRGWTYkSVKjLBuSJKlRlg1JktQoy4YkSWqUZUOSJDXKsiFJkhpl2ZAkSY2ybEiSpEZZNiRJUqMsG5IkqVGWDUmS1CjLhiRJapRlQ5IkNcqyIUmSGmXZkCRJjbJsSJKkRlk2JElSoywbkiSpUZYNSZLUKMuGJElqlGVDkiQ1yrIhSZIaZdmQJEmNsmxIkqRGWTYkSVKjLBuSJKlRlg1JktQoy4YkSWrU/wdhNdtT7NXGnQAAAABJRU5ErkJggg==\n", | |
"text/plain": [ | |
"<Figure size 648x648 with 1 Axes>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# Add a second piece to the board with the previously added piece\n", | |
"# and display the result\n", | |
"next_piece = generate_orientations(pieces[2], fn=False)[3]\n", | |
"fit, new_bd_2 = pad_piece(new_bd, next_piece)\n", | |
"if fit:\n", | |
" fig, ax = board_figure()\n", | |
" add_piece(new_bd_2)\n", | |
" show_figure(ax, \"Board with two pieces added\")" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"The general approach for the recursive function will be for the function to call itself whenever a piece in a particular orientation can be placed in the next available available space on the board. The arguments for the recursive call will be the current board state-- i.e., the board with all the pieces placed so far-- and the set of pieces that have not yet been placed.\n", | |
"\n", | |
"Whenever a piece is considered, different orientations are tried until a solution is found or none of eight possible orientations yields a solution. To keep track of which pieces have been found not to work as the next piece for a given board state, each piece thus rejected is moved to the end of the list of unplaced pieces, and a reject count is incremented. If the reject count exceeds the number of remaining pieces, the current board state is rejected as a possible partial solution.\n", | |
"\n", | |
"A solution to the puzzle requires that all the pieces are placed with no overlaps. If the recursive function is called with an empty set of pieces to be placed, the solution has been found.\n", | |
"\n", | |
"To display the progress of the program, a counter is maintained to keep track of how many calls have been made to the recursive function, and to display the board state at specified count intervals." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def fit_pieces(board, pieces, show_board_count=2500):\n", | |
" recursive_call_count = [0]\n", | |
" answer = []\n", | |
" def rec(board, pieces, reject_count):\n", | |
" recursive_call_count[0] += 1\n", | |
" if recursive_call_count[0] % show_board_count == 0:\n", | |
" clear_output()\n", | |
" fig, ax = board_figure()\n", | |
" add_piece(board)\n", | |
" show_figure(ax, \"Working... currently trying\")\n", | |
" if len(pieces) == 0:\n", | |
" answer.clear()\n", | |
" answer.append(board)\n", | |
" return True\n", | |
" elif len(pieces) < reject_count:\n", | |
" return False\n", | |
" else:\n", | |
" for piece_orientation in generate_orientations(pieces[0]):\n", | |
" (first_piece_fits, bd_with_piece) = pad_piece(board, piece_orientation[1])\n", | |
" if first_piece_fits:\n", | |
" other_pieces_fit = rec(bd_with_piece, pieces[1:], 0)\n", | |
" if other_pieces_fit:\n", | |
" return True\n", | |
" # Couldn't fit this piece here--\n", | |
" # Put it at the back of the list, increment reject_count and try next piece\n", | |
" reordered_pieces = pieces[1:]\n", | |
" reordered_pieces.append(pieces[0])\n", | |
" reject_count = reject_count + 1\n", | |
" rec(board, reordered_pieces, reject_count)\n", | |
" rec(board, pieces, 0)\n", | |
" clear_output()\n", | |
" fig, ax = board_figure()\n", | |
" add_piece(answer[-1])\n", | |
" show_figure(ax, \"Found solution:\")\n", | |
" return answer[-1]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Solve the puzzle and display the solution\n", | |
"ans = fit_pieces(bd, pieces)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Refactoring and modifications" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"The recursive function above uses a lists initialized outside the function declaration, which makes changes to the list elements essentially global, to keep track of the solution and recursive call counter. Is there an alternative way to do this?\n", | |
"\n", | |
"Can you modify the program so that it displays the recursive call count? Would you expect the final count to be the same if the initial order of the pieces were changed? \n", | |
"\n", | |
"Could there be other solutions? Can you modify the program to find them, or to show there aren't any?" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment