Question: OK so im trying so solve this problem, and it has to be done with A* search algorithm. Im getting issues with the sliding puzzle

 OK so im trying so solve this problem, and it has

OK so im trying so solve this problem, and it has to be done with A* search algorithm. Im getting issues with the sliding puzzle and understanding how the a* algorithm works with this context of switching the empty space with the tiles. From my understanding, if the empty tile is in the middle, then there are a possibility of 6 child states where the empty tile can switch with tiles up to 2 away on either side. For my heuristic, i have selected the number of white tiles to the right of the first black tile, and i believe this is a correct assumption. (please correct me if im wrong but it always underestimates i do know that)

Everywhere i look for the a* algo, I see pseudocode or real code that references each neighbor of the current node being evaluated (see the wikipedia snippet below).

to be done with A* search algorithm. Im getting issues with the

i have been able to program this and gather correct g, f, and h scores but my program is not eliminating cycles and such. I think it is because i'm not understanding what neighbors are. how would i go about gathering the neighbors and what are the neighbors? I am coding this in java so it would be helpful if it were explained in terms of that or psueudocode if nothing else. I have tried generating the up to 6 child nodes from the current node, and was unsuccessful. I have also tried generating children from the parent of the current node, but that also creates cycles. Is a neighbor coming from different paths as well? how would I go about programming that?

Consider a sliding block puzzle with the following initial configuration: There are three black tiles (B), three white tiles (W), and an empty cell (E). The puzzle has the following moves A tile may move into an adjacent empty cell with unit cost. b. a. A tile may hop over at most two other tiles into an empty cell with a cost equal to the num ber of tiles ho pped over Initial BBBWWEW BBBWWEW BBBWWEW Cost Next BBBWEWW BBBEwww BBEWWBW The goal of the puzzle is to have all of the white tiles to the left of all of the black tiles (regardless of the position of the blank cell) Consider a sliding block puzzle with the following initial configuration: There are three black tiles (B), three white tiles (W), and an empty cell (E). The puzzle has the following moves A tile may move into an adjacent empty cell with unit cost. b. a. A tile may hop over at most two other tiles into an empty cell with a cost equal to the num ber of tiles ho pped over Initial BBBWWEW BBBWWEW BBBWWEW Cost Next BBBWEWW BBBEwww BBEWWBW The goal of the puzzle is to have all of the white tiles to the left of all of the black tiles (regardless of the position of the blank cell)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve the sliding block puzzle using the A search algorithm in Java lets break down the steps to ensure you can handle the neighbors effectively and avoid cycles Understanding Neighbors In your puz... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!