Talk:15 puzzle solver: Difference between revisions

m
→‎Using A* algorithm: changed an extremely long line (which used scrolling) to normal formatting, fixed a misspelling.
(A* is not the correct algorithm to solve this task)
m (→‎Using A* algorithm: changed an extremely long line (which used scrolling) to normal formatting, fixed a misspelling.)
Line 44:
==Using A* algorithm==
I added an extra credit to to [[A* search algorithm]] :
 
<pre>
 
Use this algorithm to solve an 8 puzzle. Each node of the input graph will represent an arrangement of the tiles. The nodes will be connected by 4 edges representing swapping the blank tile up, down, left, or right. The cost of each edge is 1. The heuristic will be the sum of the manhattenManhatten distance of each numbered tile from its goal position. An 8 puzzle graph will have 9!/2 (181,440) nodes. The 15 puzzle has over 10 trillion nodes. This algorithm may solve simple 15 puzzles (but there are not many of those).
</pre>
 
 
 
Using the better heuristic used in the Python A* solution enables the solution of the task problem (using 4GB of memory). [[15 puzzle solver/20 Random]] has 20 random starting positions. Using the Python code starting positions requiring 1sec or more can not be solved on a computer with 8GB of memory. With 8GB it can test up to say 2200000 positions. So these solutions are good for extra credit medal with bar in the A* task but do not indicate that this is the correct algorithm to solve this task--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 17:25, 5 February 2019 (UTC)