Abstract
The 8-puzzle is a classical sliding puzzle that consists of 8 numbered tiles placed in random order on a board with 9 cells. The goal is to rearrange the tiles by sliding them horizontally or vertically into the vacant cell such that the number in each tile is ordered in ascending order. 8-puzzles can be solved by using the path searching algorithms such as Best-first search, Depth-fist search, Dijkstra’s algorithm, or the A* algorithm. In this paper, the A* algorithm will be the one chosen. The A* algorithm is known to be an improvement to the Dijkstra’s algorithm since not all potential paths need to be searched before the optimal one is found. The key of the A* algorithm is choosing the right heuristic formula as an estimation to the cost of each path. Two heuristics, the Hamming distance and the Manhattan distance are chosen to be implemented in the A* algorithm. The computing time for our several test puzzles suggests that the Manhattan distance is found to be the more efficient heuristic.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Reference
E.O. Osaghae, An alternative solution to N-puzzle problem. J. Appl. Sci. Environ. Manag. 22(8), 1199–1205 (2018). https://doi.org/10.4314/jasem.v22i8.9
A.K. Mishra, P.C. Siddalingaswamy, Analysis of Tree Based Search Techniques for Solving 8-puzzle Problem. In Conference 2016, LNCS 9999 (Springer Heidelberg, 2016), pp. 1–13
R.E. Korf, Recent Progress in the Design and Analysis of Admissible Heuristic Functions. In International Symposium on Abstraction, Reformulation, and Approximation. (Springer, Berlin, 2000), pp. 45–55. https://doi.org/10.1007/3-540-44914-0_3
B.M. Sathyaraj, L.C. Jain, A. Finn, S. Drake, Multiple UAVs path planning algorithms: A comparative study. Fuzzy Optim. Decis. Making 7(3), 257–267 (2008). https://doi.org/10.1007/s10700-008-9035-0
K. Mathew, M. Tabassum, Experimental comparison of uninformed and heuristic AI algorithms for N puzzle and 8 queen puzzle solution. Int. J. Digital Inf. Wirel. Commun. 4(1), 143–154 (2014). https://doi.org/10.17781/P001092
A. Reinefeld, Complete Solution of the Eight-Puzzle and the Benefit of Node Ordering in IDA*. In Proceedings of the 13th International Joint Conference on Artificial Intelligence, vol. 1 (1993), pp. 248–253
R.E. Korf, A. Felner, Disjoint pattern database heuristics. Artif. Intell. 134(2), 9–22 (2002). https://doi.org/10.1016/S0004-3702(01)00092-3
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this paper
Cite this paper
Lee, S.C., See, T.H. (2022). Comparing the Hamming and Manhattan Heuristics in Solving the 8—Puzzle by A* Algorithm. In: Mustapha, A.B., Shamsuddin, S., Zuhaib Haider Rizvi, S., Asman, S.B., Jamaian, S.S. (eds) Proceedings of the 7th International Conference on the Applications of Science and Mathematics 2021. Springer Proceedings in Physics, vol 273. Springer, Singapore. https://doi.org/10.1007/978-981-16-8903-1_19
Download citation
DOI: https://doi.org/10.1007/978-981-16-8903-1_19
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-16-8902-4
Online ISBN: 978-981-16-8903-1
eBook Packages: Physics and AstronomyPhysics and Astronomy (R0)