-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from jwg4/jupyter_support
Jupyter support
- Loading branch information
Showing
10 changed files
with
470 additions
and
10 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cells": [], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
134 changes: 134 additions & 0 deletions
134
examples/.ipynb_checkpoints/display_solutions-checkpoint.ipynb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "c5f94563", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from polyomino.board import Chessboard, Irregular\n", | ||
"from polyomino.constant import TETROMINOS, ALL_PENTOMINOS" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "a990b439", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"solution = Chessboard().tile_with(ALL_PENTOMINOS + [TETROMINOS['Square']]).solve()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "24061091", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAKlBMVEUAAADHAmpXhq27nv0P09O+aOhDO+yTXJ/3b0Je9l31av2rSvJGyVnRuL77hKSIAAAAYklEQVR4nO3Mtw3AMBAEQULekOq/XGXP5HCQ0udOAVOmMP+2CIWQMHmorBYh4TjhFnyzh8MiJMweertFSJg9PIXrI0LCccI7qLqG3rTwCISE2UNV97BZhIQjhtVSDSFh8vAFbS7Jkaszv9kAAAAASUVORK5CYII=\n", | ||
"text/plain": [ | ||
"<polyomino.solution.Solution at 0x6f537fe8>" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"solution" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "076e18a7", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"+-+-+-+-+-+-+-+-+\n", | ||
"| | | |\n", | ||
"+ +-+-+-+-+-+ +\n", | ||
"| | | |\n", | ||
"+-+ +-+ +-+-+-+-+\n", | ||
"| | | | | |\n", | ||
"+ +-+-+-+ +-+-+ +\n", | ||
"| | | |\n", | ||
"+-+-+-+-+-+-+ + +\n", | ||
"| | | | |\n", | ||
"+-+ +-+-+ +-+-+-+\n", | ||
"| | | | | | |\n", | ||
"+ +-+ + +-+ +-+ +\n", | ||
"| | | | | |\n", | ||
"+ +-+ +-+ +-+ +\n", | ||
"| | | | |\n", | ||
"+-+-+-+-+-+-+-+-+\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(solution.display())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "45085dd3", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAHgAAACgCAMAAADw11iiAAAAk1BMVEUAAACBwY3ac/hk0/mbAEoJ9QGTXJ7ydEoWUaeNs7AXWTtcDgONxtiUs2IrEdqBgtgbhHCs6SGq72YpD6d4r8iWYLJ1mXWi2op3zdOIlOALFnivsiUhhdoFzLH3PGk3RDY4tweuj5Rka49aRhpf1ElPVhqFkRlyJ7oUG+/958OetdD6VNMXulL7EKfxKRLFMco+FIFhhjlHAAABL0lEQVR4nO3OSVJCURQEUcNeOhUUBLEDsRdk/5tzVjWpeIMfd5i5gZMHh82O1HGzE3WqzpodAAMDA3eGz1Xi3IVKXILTQk8BAwMDV8CurxLsBirBQ9ULAQMDA1fA/WbmRmoQGoYuFTAwMHAFfNXsWo1C5sZqohLsgIGBgbvDNypx7lYZHocmIXNTBQwMDFwBu5lKsLtTCZ6raQgYGBi4Al6oWShxqXnoXgEDAwNXwIuQuaV6aPaonlSCHTAwMHB3+FkZXoZeVOIS7MytFDAwMHAF7NYqwe5VJXijViFgYGDgCnjdLHGpTehNAQMDA1fA780+1GezL/WtEuyAgYGBu8M/KnHuVyUuwc7cVgEDAwNXwG6nEuz+VIL3ahsCBgYGroB3zRKX2jcDBgYGLoD/ASi7eOqIz7E2AAAAAElFTkSuQmCC\n", | ||
"text/plain": [ | ||
"<polyomino.solution.Solution at 0x6f59b5e0>" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"board = Irregular([(i, j) for i in range(0, 12) for j in range(0, 16)])\n", | ||
"problem = board.tile_with_many(TETROMINOS['T'])\n", | ||
"problem.solve()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ba1efa04", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.9.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "2f48725f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from polyomino.board import Chessboard\n", | ||
"from polyomino.constant import DOMINO" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "325f7427", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAMAAAC45U6nAAAABlBMVEX///8AAABVwtN+AAAAV0lEQVR4nO3ZyQ0AIAgAQe2/aTsgGokHmS2A4eNHWpP0Wj2n2MjZlMFgLE2ZfaFbRspkBoPBYDAYDAaDwWAwGAwGg8FgMKob8a/93xcJBqOAceBqLulGA1OUAUFeFCJvAAAAAElFTkSuQmCC\n", | ||
"text/plain": [ | ||
"<polyomino.board.DeletedRectangle at 0x6f56ef58>" | ||
] | ||
}, | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"Chessboard().remove((0, 0)).remove((7, 7))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "c9cc6b80", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAMAAAC45U6nAAAABlBMVEX///8AAABVwtN+AAAAV0lEQVR4nO3ZsQ0AIAgAQdx/aTcwGJFQ3LcmnI2NREia1qrpbNTclMFgXE3JvtAno2Qyg8FgMBgMBoPBYDAYDAaDwWAwGIONhv/27CmDwfhuNOzPJfW1AVLMAUGKU2ZPAAAAAElFTkSuQmCC\n", | ||
"text/plain": [ | ||
"<polyomino.board.DeletedRectangle at 0x6f56e8b0>" | ||
] | ||
}, | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"Chessboard().remove((0, 0)).remove((0, 7))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "1d7225b7", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAYFBMVEUAAADRfMe128vfBLykVLaAn4yORk/ED0Y7BRi4APlDH8DH99yFDqL6Syfy7QqxZoaXsVkrI/w6ikMOoXxywYIZDnn655alzz6GxzDOGxJq621IrlMSBZmPuhg0uoxthljQxCNxAAAAb0lEQVR4nO3MSQ6CQAAAwYmoKCKLiops/v+V3JoTyZwnXQ+oEHBAhiNOOCPHBcHQMMnwCkNDw5iwwA0l7qhQo4GhYZphC0NDw5jwgSde6PDGB18YGqYZ9jA0NIwJfxgwYsKMBX8YGqYZbgwNDXfDFSiJm8jaDSAvAAAAAElFTkSuQmCC\n", | ||
"text/plain": [ | ||
"<polyomino.solution.Solution at 0x6f558c10>" | ||
] | ||
}, | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"Chessboard().remove((0, 0)).remove((0, 7)).tile_with_many(DOMINO).solve()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 15, | ||
"id": "722aee60", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAMAAAC45U6nAAAABlBMVEX///8AAABVwtN+AAAAZklEQVR4nO3ZSQrAIBAAQf3/pz0L4gLjAlYfQ6DMYQRNSpLeKEfXMqLXzGAwGAwGg8FgMBgMxldG/9wdZEy+x2AwNhmNOV+/c1vfr/rfxmAwthsH5nywAgaDwWAwGPWzA//PJd2oACSvAZFe6vBVAAAAAElFTkSuQmCC\n", | ||
"text/plain": [ | ||
"<polyomino.board.DeletedRectangle at 0x65fd08e0>" | ||
] | ||
}, | ||
"execution_count": 15, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"Chessboard().remove((3, 4)).remove((5, 5))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"id": "a8b83b0a", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAYFBMVEUAAAD/WpECZ4JtsHwtqH/UjXsc4mfFa/yqRlVFJ7raNUcvOyNN8Q0Hhde1j2rAMtm5mlOnufGBFbMsR9seR9flE24JuRvEDZodeWqCj4X3DFETOpC+wkNJ57OeZkN2KD3VpDDiAAAAdElEQVR4nO3N2xWCMADA0B4FBBFUQPCJ7j+lf+lPJ6C5AyRhhz0KlKhwQI0GwaBBgwYNZhs8osUJHXqcccEVBg0aNGgw3+CAERMCbpgTFhg0mGPwjhiMkwcMGtx68IkX3ojBT0IMrjBoMMfgN+GXYNDgxoN/pFKbyN9fg4YAAAAASUVORK5CYII=\n", | ||
"text/plain": [ | ||
"<polyomino.solution.Solution at 0x65fd0118>" | ||
] | ||
}, | ||
"execution_count": 14, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"Chessboard().remove((3, 4)).remove((5, 5)).tile_with_many(DOMINO).solve()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "eeb51823", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.9.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.