diff --git a/examples/constants.md b/examples/constants.md index dca9dc0..ebec261 100644 --- a/examples/constants.md +++ b/examples/constants.md @@ -1,6 +1,7 @@ ```python >>> from polyomino.constant import * >>> from polyomino.piece import display + ``` ```python @@ -10,6 +11,7 @@ +-+ +-+ | | +-+ + ``` ```python @@ -21,6 +23,7 @@ + + | | +-+ + ``` ```python @@ -30,6 +33,7 @@ + + | | +-+-+ + ``` ```python @@ -37,6 +41,7 @@ +-+-+-+-+ | | +-+-+-+-+ + ``` ```python @@ -46,6 +51,7 @@ +-+ +-+ | | +-+-+ + ``` ```python @@ -57,6 +63,7 @@ + + | | +-+ + ``` ```python @@ -66,4 +73,5 @@ +-+ +-+ | | +-+-+ + ``` \ No newline at end of file diff --git a/examples/easy.md b/examples/easy.md index ad53124..663483a 100644 --- a/examples/easy.md +++ b/examples/easy.md @@ -17,4 +17,5 @@ + +-+ +-+ | | | +-+-+-+-+ + ``` \ No newline at end of file diff --git a/examples/fluid.md b/examples/fluid.md index c434a9c..75cbb99 100644 --- a/examples/fluid.md +++ b/examples/fluid.md @@ -4,24 +4,29 @@ >>> from polyomino.board import Chessboard >>> from polyomino.constant import MONOMINO, DOMINO >>> from polyomino.tileset import many + ``` ```python >>> Chessboard() + ``` ```python >>> Chessboard().tile_with_many(DOMINO) + ``` ```python >>> Chessboard().tile_with_set(many(DOMINO).and_repeated_exactly(2, MONOMINO)) + ``` ```python >>> Chessboard().tile_with_set(many(DOMINO).and_repeated_exactly(2, MONOMINO)).with_heuristics() + ``` \ No newline at end of file diff --git a/examples/gardner.md b/examples/gardner.md index 2d95b5b..f8998fa 100644 --- a/examples/gardner.md +++ b/examples/gardner.md @@ -7,6 +7,7 @@ These examples are taken from chapter 13 of 'Mathematical Puzzles and Diversions >>> from polyomino.constant import ONESIDED_TETROMINOS >>> from polyomino.constant import TETROMINOS, ALL_PENTOMINOS >>> from polyomino.tileset import many, repeated_exactly, any_number_of + ``` >[...] >In Chapter 3 (problem 3) we considered a polyomino problem dealing with the placing of dominoes on a mutilated chessboard. @@ -16,17 +17,20 @@ These examples are taken from chapter 13 of 'Mathematical Puzzles and Diversions ```python >>> Chessboard().remove((0, 0)).remove((7, 7)).tile_with_many(DOMINO) + ``` [An impossible tiling will give the solution `None`.] ```python >>> Rectangle(4, 4).remove((0, 0)).remove((3, 3)).tile_with_many(DOMINO).solve() + ``` ```python >>> Chessboard().remove((0, 0)).remove((0, 7)).tile_with_many(DOMINO).solve().tiling [[(0, 1), (0, 2)], [(0, 3), (0, 4)], [(0, 5), (0, 6)], [(1, 0), (1, 1)], [(1, 2), (1, 3)], [(1, 4), (1, 5)], [(1, 6), (1, 7)], [(2, 0), (2, 1)], [(2, 2), (2, 3)], [(2, 4), (2, 5)], [(2, 6), (2, 7)], [(3, 0), (3, 1)], [(3, 2), (3, 3)], [(3, 4), (3, 5)], [(3, 6), (3, 7)], [(4, 0), (4, 1)], [(4, 2), (4, 3)], [(4, 4), (4, 5)], [(4, 6), (4, 7)], [(5, 0), (5, 1)], [(5, 2), (5, 3)], [(5, 4), (5, 5)], [(5, 6), (5, 7)], [(6, 0), (6, 1)], [(7, 0), (7, 1)], [(6, 2), (6, 3)], [(7, 2), (7, 3)], [(6, 4), (6, 5)], [(7, 4), (7, 5)], [(6, 6), (6, 7)], [(7, 6), (7, 7)]] + ``` ```python @@ -48,6 +52,7 @@ These examples are taken from chapter 13 of 'Mathematical Puzzles and Diversions +-+ + + + + + + + | | | | | | | | +-+-+-+-+-+-+-+ + ``` ```python @@ -69,6 +74,7 @@ These examples are taken from chapter 13 of 'Mathematical Puzzles and Diversions +-+-+-+ + +-+-+-+ | | | | | +-+-+-+-+-+-+-+-+ + ``` ```python @@ -90,10 +96,12 @@ These examples are taken from chapter 13 of 'Mathematical Puzzles and Diversions +-+-+-+-+-+-+ + + | | | | | +-+-+-+-+-+-+-+-+ + ``` ```python >>> Chessboard().remove((2, 3)).tile_with_many(STRAIGHT_TROMINO).solve() + ``` ```python @@ -115,11 +123,13 @@ These examples are taken from chapter 13 of 'Mathematical Puzzles and Diversions + +-+ + +-+ + +-+ | | | | | | +-+-+-+-+-+-+-+-+ + ``` ```python >>> [name for name in ONESIDED_TETROMINOS if Chessboard().tile_with_many(ONESIDED_TETROMINOS[name]).solve() is None] ['S', 'Z'] + ``` As mentioned on p118, there is an easy argument to show that this is impossible - naive search is computationally intractable. @@ -127,6 +137,7 @@ As mentioned on p118, there is an easy argument to show that this is impossible ```python >>> Chessboard().tile_with_set(any_number_of([ONESIDED_TETROMINOS['L'], ONESIDED_TETROMINOS['J']]).and_one(TETROMINOS['Square'])) + ``` ```python @@ -148,4 +159,5 @@ As mentioned on p118, there is an easy argument to show that this is impossible + +-+ +-+ +-+ + | | | | | +-+-+-+-+-+-+-+-+ + ``` \ No newline at end of file diff --git a/examples/more.md b/examples/more.md index 4b70c7d..aa30f08 100644 --- a/examples/more.md +++ b/examples/more.md @@ -1,6 +1,7 @@ ```python >>> from polyomino.board import Irregular, Rectangle >>> from polyomino.constant import TETROMINOS + ``` ```python @@ -41,6 +42,7 @@ + +-+ +-+ +-+ +-+-+ +-+ + | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+ + ``` ```python @@ -102,4 +104,5 @@ +-+ +-+ + | | | | +-+ +-+ + ``` \ No newline at end of file