%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  NAME :
%      421.pl
%
% VERSION :
%     0
%
% AUTHOR : Matthieu Petit, Arnaud Gotlieb and Arnaud Jobin
%
% FUNCTION :
%      Implementation of 421 dice play
%      
% REMARKS : any problem, contact petit@(without advertissement)irisa.fr
%
% NOTE TO THE USER :  need ctr_proba_v0.pl to work
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%-----------------
% Experiments 421
%-----------------

quatre_deux_un(X,Y,W,Distribution) :-
        init_env(Env),
        Distribution = [P1,P2,P3,P4,P5,P6],
        P1 in 1..5,
        P2 in 1..5,
        P3 in 1..5,
        P4 in 1..5,
        P5 in 1..5,
        P6 in 1..5,
        2*P1#=P6,
        2*P2#=P5,
        2*P4#=P3,
        choose(X, [1,2,3,4,5,6]-[P1,P2,P3,P4,P5,P6], [], [domain_bound], Env),
        choose(Y, [1,2,3,4,5,6]-[P1,P2,P3,P4,P5,P6], [], [domain_bound], Env),
        choose(W, [1,2,3,4,5,6]-[P1,P2,P3,P4,P5,P6], [], [domain_bound], Env),
        all_different([X,Y,W]),
        X+Y+W#=7,
        fin_env(Env).




quatre_deux_un_bis(Y1,Y2,Y3,Distribution) :-
        init_env(Env),
        Distribution = [P1,P2,P3,P4,P5,P6],
        P1 in 1..5,
        P2 in 1..5,
        P3 in 1..5,
        P4 in 1..5,
        P5 in 1..5,
        P6 in 1..5,
        2*P1#=P6,
        2*P2#=P5,
        2*P4#=P3,
        choose(X, [1,2,3,4,5,6]-[P1,P2,P3,P4,P5,P6], [], [], Env),
        choose(Y, [1,2,3,4,5,6]-[P1,P2,P3,P4,P5,P6], [], [], Env),
        choose(W, [1,2,3,4,5,6]-[P1,P2,P3,P4,P5,P6], [], [], Env),
        all_different([X,Y,W]),
        X+Y+W#=7,
        fin_env(Env).



