move(1,0).
move(0,1).
move(0,2).
move(2,0).
move(1,1).
legal((X,Y,_)):-legal1(X),legal1(Y).
legal1((X,Y)):-X=:=0,Y>=0,!.
legal1((X,Y)):-Y=:=0,X>=0,!.
legal1((X,Y)):-X>=Y,X>=0,Y>=0.
update((X,Y,0),Move,Statu1):-
(A,B)=X,
(C,D)=Y,
(E,F)=Move,
C1 is C+E,
D1 is D+F,
A1 is A-E,
B1 is B-F,
Statu1=((A1,B1),(C1,D1),1).
update((X,Y,1),Move,Statu1):-
(A,B)=X,
(C,D)=Y,
(E,F)=Move,
C1 is C-E,
D1 is D-F,
A1 is A+E,
B1 is B+F,
Statu1=((A1,B1),(C1,D1),0).
connect(Statu,Statu1):-
move(X,Y),
update(Statu,(X,Y),Statu1),
legal(Statu1).
findroad(X,X,L,L):-write(L).
findroad(X,Y,L,L1):-
connect(X,Z),
not(member(Z,L)),
findroad(Z,Y,[Z|L],L1).
有两种选择WINDOWS API SDKMFC建议从SDK开始学,了解windows程序的运行机制,包括界面,消息循环等等。然后再深入的学习MFC学习这些的前提是你要对C++和面向对象有足够程度的了解。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)