Slide Puzzle Solver

preview_player
Показать описание
Wrote Entire Program In Python With Pygame.
Wrote Astar algorithm that can navigate a grid efficiently while avoiding given tiles. Made simple solver to arrange tiles row by row, leaving out the last 2 columns/rows. (no complications at all to do that) you just tell your path finder to bring the next tile, while avoiding the solved ones. then for the sides, i.e. the bottom rows, you're solving two at a time, by bringing the bottom one first above where it goes, the then the top one to the right of it, then tell the path finder to finish solving them both (since they're both ready to go right in) finally you spin around the 2x2 by simply solving one of them and putting the opentile in bottom right.

to have a different arrangement, you trick the solver into thinking it's still solving the normal default values. so if tile 5 is in 1's slot on the target board, it now tells itself tile 1 is wherever tile 5 is at the beginning. so that it'll ultimately be going for tile 5. the method only solves where the opentile finishes at the bottom-right corner, so if your arrangement is different, you also have to do a quick modification to the target board, by shifting the opentile all the way right, then all the way down. (or use the pathfinder to do it directly towards to look better) and finally with that same path of moves, you can undo that same translation of tiles again, so they go where they were intended.
Рекомендации по теме
Комментарии
Автор

i used to think it searches for time numeber 1 then tries to send it back to its orriginal place, but it seems not the case here

dyyno