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

%-----------------
% Experiments lessthan8
%-----------------

moins_8([W1,W2,W3,W4],Options) :-
        init_env(Env),
        W1 in 1..10,
        W2 in 1..10,
        W3 in 1..10,
        W4 in 1..10,
        4*W4 #= W1,
        3*W4 #= W2,        
        2*W4 #= W3,
        choose(D1, [1,2,3,4]-[W1,W2,W3,W4], [], Options, Env),
        choose(D2, [1,2,3,4]-[W1,W2,W3,W4], [], Options, Env),
        choose(D3, [1,2,3,4]-[W1,W2,W3,W4], [], Options, Env),
        choose(D4, [1,2,3,4]-[W1,W2,W3,W4], [], Options, Env),
        choose(D5, [1,2,3,4]-[W1,W2,W3,W4], [], Options, Env),
        Sum #= D1+D2+D3+D4+D5,
        Sum#=<8,
        fin_env(Env).


moins_8_bis([W1,W2,W3,W4,W5,W6],Options) :-
        init_env(Env),
        W1 in 1..10,
        W2 in 1..10,
        W3 in 1..10,
        W4 in 1..10,
        W5 in 1..10,
        W6 in 1..10,
        4*W6 #= W1,
        3*W5 #= W2,        
        2*W4 #= W3,
        choose(D1, [1,2,3,4,5,6]-[W1,W2,W3,W4,W5,W6], [], Options, Env),
        choose(D2, [1,2,3,4,5,6]-[W1,W2,W3,W4,W5,W6], [], Options, Env),
        choose(D3, [1,2,3,4,5,6]-[W1,W2,W3,W4,W5,W6], [], Options, Env),
        choose(D4, [1,2,3,4,5,6]-[W1,W2,W3,W4,W5,W6], [], Options, Env),
        choose(D5, [1,2,3,4,5,6]-[W1,W2,W3,W4,W5,W6], [], Options, Env),
        Sum #= D1+D2+D3+D4+D5,
        Sum#=<8,
        fin_env(Env).

