sliding-tile-puzzle

How to solve 15-puzzle paradigm in Prolog with Manhattan & Hamming Heuristics

半腔热情 提交于 2020-04-11 05:32:29
问题 I have this implementation of the 15-puzzle game, using Prolog (Swipl). I have already implemented the A* search using Manhattan heuristic, but now I need to add hamming heuristic. Do yo know how to implement it? :- op(400,yfx,'@'). resolver(Estado,MovimientosSolucion) :- evaluar(Estado,0,F), buscarSolucion([Estado@0@F@[]],S), reverse(S,MovimientosSolucion). evaluar(Estado,Profundidad,F) :- evaluarCoste(Estado,Coste), F is Profundidad + Coste. buscarSolucion([Estado@_@_@MovimientosSolucion|_]

How to solve 15-puzzle paradigm in Prolog with Manhattan & Hamming Heuristics

六月ゝ 毕业季﹏ 提交于 2020-04-11 05:32:08
问题 I have this implementation of the 15-puzzle game, using Prolog (Swipl). I have already implemented the A* search using Manhattan heuristic, but now I need to add hamming heuristic. Do yo know how to implement it? :- op(400,yfx,'@'). resolver(Estado,MovimientosSolucion) :- evaluar(Estado,0,F), buscarSolucion([Estado@0@F@[]],S), reverse(S,MovimientosSolucion). evaluar(Estado,Profundidad,F) :- evaluarCoste(Estado,Coste), F is Profundidad + Coste. buscarSolucion([Estado@_@_@MovimientosSolucion|_]