A089473
Number of configurations of the sliding block 8-puzzle that require a minimum of n moves to be reached, starting with the empty square in one of the corners.
Original entry on oeis.org
1, 2, 4, 8, 16, 20, 39, 62, 116, 152, 286, 396, 748, 1024, 1893, 2512, 4485, 5638, 9529, 10878, 16993, 17110, 23952, 20224, 24047, 15578, 14560, 6274, 3910, 760, 221, 2
Offset: 0
From the starting configuration
123
456
78-
the two final configurations requiring 31 moves are
647 ... 867
85- and 254
321 ... 3-1
- For references and links see A087725.
- Hugo Pfoertner, FORTRAN program to solve small sliding block puzzles.
- Hugo Pfoertner, Table of solution lengths of the 8-puzzle
- I. Kapustik, Cesta.
- J. Knuuttila, S. Broman and P. Ranta, n-Puzzle, in Finnish (2002).
- A. Reinefeld, Complete Solution of the Eight-Puzzle and the Benefit of Node Ordering in IDA*. Proc. 13th Int. Joint Conf. on Artificial Intelligence (1993), Chambery Savoi, France, pp. 248-253.
- Takaken, n-Puzzle Page.
- Takaken, No. 33 (8 puzzles).
Cf.
A087725 = maximum number of moves for n X n puzzle,
A089474 = 8-puzzle starting with blank square at center,
A089483 = 8-puzzle starting with blank square at mid-side,
A089484 = solution lengths for 15-puzzle,
A090031 -
A090036 = other sliding block puzzles.
-
# alst(), swap(), moves() useful for other sliding puzzle problems
def swap(p, z, nz):
lp = list(p)
lp[z], lp[nz] = lp[nz], "-"
return "".join(lp)
def moves(p, shape): # moves for n x m sliding puzzle
nxt, (n, m), z = [], shape, p.find("-") # z: blank location
if z > n - 1: nxt.append(swap(p, z, z-n)) # blank up
if z < n*m-n: nxt.append(swap(p, z, z+n)) # blank down
if z%n != 0: nxt.append(swap(p, z, z-1)) # blank left
if z%n != n-1: nxt.append(swap(p, z, z+1)) # blank right
return nxt
def alst(start, shape, v=False, maxd=float('inf')):
alst, d, expanded, frontier = [], 0, set(), {start}
alst.append(len(frontier))
if v: print(len(frontier), end=", ")
while len(frontier) > 0 and d < maxd:
reach1 = set(m for p in frontier for m in moves(p, shape) if m not in expanded)
expanded |= frontier # expanded = frontier # ALTERNATE using less memory
if len(reach1):
alst.append(len(reach1))
if v: print(len(reach1), end=", ")
frontier = reach1
d += 1
return alst
print(alst("-12345678", (3, 3))) # Michael S. Branicky, Dec 28 2020
A087725
Maximal number of moves required for the n X n generalization of the sliding block 15-puzzle (or fifteen-puzzle).
Original entry on oeis.org
All solvable configurations of the Eight Puzzle on a 3 X 3 matrix can be solved in 31 moves or fewer and some configurations require 31 moves, so a(3)=31.
- E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, see Vol. 2 for the classical 4 X 4 puzzle.
- J. C. Culberson and J. Schaeffer, Computer Intelligence, vol. 14.3 (1998) 318-334.
- Richard E. Korf and Larry A Taylor, Disjoint pattern database heuristics, in "Chips Challenging Champions" by Schaeffer and Herik, pp. 13-26.
- K. Krawiec, Medial Crossovers for Genetic Programming, in Genetic Programming, Springer, 2012.
- C. A. Pickover, The Math Book, Sterling, NY, 2009; see p. 262.
- J. Slocum and D. Sonneveld, The 15 Puzzle, The Slocum Puzzle Foundation, 2006.
- A. Brüngger, A. Marzetta, K. Fukuda and J. Nievergelt, The parallel search bench ZRAM and its applications, Annals of Operations Research 90 (1999), pp. 45-63.
- Hannanov Bulat, 208s for 5x5.
- Joseph C. Culberson and Jonathan Schaeffer, Searching with Pattern Databases
- E. D. Demaine, Playing Games with Algorithms: Algorithmic Combinatorial Game Theory, 2001.
- Filip R. W. Karlemo and Patric R. J. Östergård, On Sliding Block Puzzles, J. Combin. Math. Combin. Comp. 34 (2000), 97-107.
- Richard E. Korf, Depth-First Iterative-Deeping: An Optimal Admissible Tree Search, Artificial Intelligence, 27(1), 97-110, 1985.
- Richard E. Korf and Larry A Taylor, Finding Optimal Solutions to the Twenty-Four Puzzle, Proceedings of the 11th National Conference on Artificial Intelligence, 756-761, 1993.
- Anton Kulchitsky, Comments on the Fifteen Puzzle
- Swathy Muralidharan, The Fifteen Puzzle--A New Approach, Mathematics Magazine, Vol. 90, No. 1 (February 2017), pp. 48-57.
- Ian Parberry, A real-time algorithm for the (n^2 - 1)-puzzle, Inf. Process. Lett. 56 (1995), pp. 23-28.
- D. Ratner and M. Warmuth, Finding a shortest solution for the (N x N)-extension of the 15-puzzle is intractable, J. Symbolic Computation, 10: 111-137, 1990.
- A. Reinefeld, Complete Solution of the Eight-Puzzle ..., Internat. Joint Conf. Artificial Intell., pp. 248-253, 1993.
- Tomas Rokicki, 24 puzzle new lower bound: 152
- Eric Weisstein's World of Mathematics, 15 Puzzle in MathWorld
- Ben Whitmore, 5x5 sliding puzzle can be solved in 205 moves
- Wikipedia, 15 puzzle
-
# alst(), moves(), swap() in A089473
for n in range(1, 4): # chr(45) is "-"
start, shape = "".join(chr(45+i) for i in range(n**2)), (n, n)
print(len(alst(start, shape))-1, end=", ") # Michael S. Branicky, Aug 02 2021
a(3) is from Reinefeld, who used the method of Korf.
a(4) was found by Brüngger, Marzetta, Fukuda and Nievergelt (thanks to Patric Östergård for this reference)
A089484
Number of positions of the 15-puzzle at a distance of n moves from an initial state with the empty square in one of the corners, in the single-tile metric.
Original entry on oeis.org
1, 2, 4, 10, 24, 54, 107, 212, 446, 946, 1948, 3938, 7808, 15544, 30821, 60842, 119000, 231844, 447342, 859744, 1637383, 3098270, 5802411, 10783780, 19826318, 36142146, 65135623, 116238056, 204900019, 357071928, 613926161, 1042022040
Offset: 0
-
# alst(), moves(), swap() in A089473
start, shape = "-123456789ABCDEF", (4, 4)
alst(start, shape, v=True) # Michael S. Branicky, Dec 31 2020
More terms from Herman Jamke (hermanjamke(AT)fastmail.fm), Oct 19 2006
A089483
Number of configurations of the sliding block 8-puzzle that require a minimum of n moves to be reached, starting with the empty square at mid-side.
Original entry on oeis.org
1, 3, 5, 10, 14, 28, 42, 80, 108, 202, 278, 524, 726, 1348, 1804, 3283, 4193, 7322, 8596, 13930, 14713, 21721, 19827, 25132, 18197, 18978, 9929, 7359, 2081, 878, 126, 2
Offset: 0
Starting with
1-2
345
678
the two final configurations requiring 31 moves are
86- ... -86
547 and 743
231 ... 251
A090032
Number of configurations of the 6 X 6 variant of Sam Loyd's sliding block 15-puzzle ("35-puzzle") that require a minimum of n moves to be reached, starting with the empty square in one of the corners.
Original entry on oeis.org
1, 2, 4, 10, 26, 66, 171, 440, 1112, 2786, 6820, 16720, 41106, 100856, 245793, 597030, 1441292, 3469486, 8304526, 19832076, 47110238, 111669014
Offset: 0
-
# uses alst(), swap() in A089473
start, shape = "-123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", (6, 6)
print(alst(start, shape, maxd=16)) # Michael S. Branicky, Jan 02 2021
A089474
Number of configurations of the sliding block 8-puzzle that require a minimum of n moves to be reached, starting with the empty square in the center.
Original entry on oeis.org
1, 4, 8, 8, 16, 32, 60, 72, 136, 200, 376, 512, 964, 1296, 2368, 3084, 5482, 6736, 11132, 12208, 18612, 18444, 24968, 19632, 22289, 13600, 11842, 4340, 2398, 472, 148
Offset: 0
Starting with
123
4-5
678
two of the 148 configurations that require the maximum of 30 moves are
476 ... -86
2-8 and 724
351 ... 351
A090377
Number of configurations that require a minimum of n moves to be reached, starting with the empty square in one of the corners of an infinitely large extension of Sam Loyd's sliding block 15-puzzle.
Original entry on oeis.org
1, 2, 4, 10, 26, 66, 173, 456, 1230, 3318, 9066, 24768, 68304, 188370, 523083, 1452560, 4054708, 11318926
Offset: 0
-
# uses alst(), swap() in A089473
nn = 13
start = "".join([chr(i) for i in range(45, 45+(nn+1)**2)]) # chr(45) is "-"
print(alst(start, (nn+1, nn+1), maxd=nn)) # Michael S. Branicky, Jan 02 2021
A264040
Number of possible permutations of the n X n generalization of the sliding block 15-puzzle.
Original entry on oeis.org
1, 12, 181440, 10461394944000, 7755605021665492992000000, 185996663394950608733999724075417600000000, 304140932017133780436126081660647688443776415689605120000000000, 63443466092942082051716694667580740401432758087272596099400947187607352115200000000000000
Offset: 1
a(4) = 10461394944000 because the standard 4 X 4 version of the 15-puzzle has exactly 10461394944000 permutations that can be reached by sliding the tiles.
- Eric Weisstein's World of Mathematics, 15 Puzzle
Showing 1-8 of 8 results.
Comments