

/* application */

regle(t(M,C,Rn),[Mn,Cn,Rn]):-
		etat([Mc,Cc,Rc]),
		succ(Rc,Rn),
		enum(M,0,Mc),
		enum(C,0,Cc),
		M + C >= 1,
		M + C =< 2,
		M =< Mc,
		C =< Cc,
                Mo is Mc-M, Co is Cc-C,
		ok(Mo,Co),
		Mn is (3-Mc)+M,
		Cn is (3-Cc)+C,
		ok(Mn,Cn).



ok(0,C) :- C > 0.
ok(M,C) :- M >= C.

etat_succes([3,3,droite]).
etat_initial([3,3,gauche]).

succ(gauche,droite).
succ(droite,gauche).


profondeur_max(12).

/*

| ?-  compile(bkC).
{compiling /u/rueher/Enseignement/PROLOG/Exercices/Puzzles/bkC...}
{Warning: [E] - singleton variables in solve/2 in lines 13-15}
{Warning: [L,Ec] - singleton variables in apply/4 in lines 27-29}
{Warning: [Y] - singleton variables in enum/3 in lines 41-46}
{/u/rueher/Enseignement/PROLOG/Exercices/Puzzles/bkC compiled, 126 msec 1648 bytes}
 
yes
| ?- compile(baseCanmissC).
{compiling /u/rueher/Enseignement/PROLOG/Exercices/Puzzles/baseCanmissC...}
{/u/rueher/Enseignement/PROLOG/Exercices/Puzzles/baseCanmissC compiled, 71 msec 2016 bytes}
 
yes
| ?-  bk(T).
 
T = [t(0,2,droite),t(0,1,gauche),t(0,2,droite),t(0,1,gauche),t(2,0,droite),t(1,1,gauche),t(2,0,droite),t(0,1,gauche),t(0,2,droite),t(0,1,gauche),t(0,2,droite)] ? ;
 
T = [t(0,2,droite),t(0,1,gauche),t(0,2,droite),t(0,1,gauche),t(2,0,droite),t(1,1,gauche),t(2,0,droite),t(0,1,gauche),t(0,2,droite),t(1,0,gauche),t(1,1,droite)] ? ;
 
T = [t(1,1,droite),t(1,0,gauche),t(0,2,droite),t(0,1,gauche),t(2,0,droite),t(1,1,gauche),t(2,0,droite),t(0,1,gauche),t(0,2,droite),t(0,1,gauche),t(0,2,droite)] ? ;
 
T = [t(1,1,droite),t(1,0,gauche),t(0,2,droite),t(0,1,gauche),t(2,0,droite),t(1,1,gauche),t(2,0,droite),t(0,1,gauche),t(0,2,droite),t(1,0,gauche),t(1,1,droite)] ? ;
 
no
*/
