haihongyuan.com
海量文库 文档专家
全站搜索:
您现在的位置:首页 > 初中教育 > 初中历政地初中历政地

8骑士

发布时间:2014-05-22 08:12:47  

move(squre(Row,Column),squre(New_Row,New_Column)):-
Row=<6,New_Row is Row+2,Column=<7,New_Column is Column+1.
move(squre(Row,Column),squre(New_Row,New_Column)):-
Row=<6,New_Row is Row+2,Column>=2,New_Column is Column-1.
move(squre(Row,Column),squre(New_Row,New_Column)):-
Row>=3,New_Row is Row-2,Column=<7,New_Column is Column+1.
move(squre(Row,Column),squre(New_Row,New_Column)):-
Row>=3,New_Row is Row-2,Column>=2,New_Column is Column-1.

move(squre(Row,Column),squre(New_Row,New_Column)):-
Row=<7,New_Row is Row+1,Column=<6,New_Column is Column+2.
move(squre(Row,Column),squre(New_Row,New_Column)):-
Row=<7,New_Row is Row+1,Column>=3,New_Column is Column-2.
move(squre(Row,Column),squre(New_Row,New_Column)):-
Row>=2,New_Row is Row-1,Column=<6,New_Column is Column+2.
move(squre(Row,Column),squre(New_Row,New_Column)):-
Row>=2,New_Row is Row-1,Column>=3,New_Column is Column-2.

been(squre(0,0)).

path(X,X).
path(X,Y):-move(X,Z),not(been(Z)),dynamic(knight_tour,been/1),asserta(knight_tour,been(Z)),path(Z,Y).



网站首页网站地图 站长统计
All rights reserved Powered by 海文库
copyright ©right 2010-2011。
文档资料库内容来自网络,如有侵犯请联系客服。zhit326@126.com