I hope to have your help to solve the problem I am facing. I'm trying to make an 8-puzzle solver but I'm in doubt about how to select the next board, from the one they have already given me. Below I expose my doubt:
In order to get from the initial state to the final state, I have built some functions, which I explain below. The first function is the one that returns the children so they call them from a particular board, in my case the parent board is the initial state, so their children are:
The following function that I have built returns the amount of pieces that are not in place, so in this example, the misplaced tiles of each son respectively are:
I must mention that zero is not taken into account, to calculate the total of pieces out of place. Finally, the function that calculates manhattan distances also implements it, if we use it in each child we can know its manhattan distance, it is important to remember that zero is not taken into account to calculate in this function, so we obtain:
My doubt arises when trying to understand which child board should be selected, because if I use Manhattan distance as a criterion, as you can see there is a tie between board B and C, so I could use it as a tiebreaker criterion, tiles out of place, is say, choose the board that has less tiles out of place, which would take me to take the board C, but in some online applet, select the board A, could someone tell me the reason for choosing the board A and not the board C ?. Thanks in advance, any help is welcome.