Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game_winner([],_).
- game_winner(Game,Res):- %sau game_winner([Player1,Player2],Res)
- nth0(0,Game,Player1),
- nth0(1,Game,Player2),
- condition(Player1,Player2,Res).
- condition(L1,L2,Result):-
- nth0(1,L1,Option1),
- nth0(1,L2,Option2),
- ( (
- ( Option1='R', Option2='S',Result=L1);
- ( Option1='S', Option2='P',Result=L1);
- ( Option1='P', Option2='R',Result=L1)
- );
- (
- ( Option1='S', Option2='R',Result=L2);
- ( Option1='P', Option2='S',Result=L2);
- ( Option1='R', Option2='P',Result=L2)
- )).
- %game_winner([[X,'R'],[Y,'P']] , [Y,'P']). %var statica
- tournament([Tour1,Tour2],Result):-
- tournament(Tour1,R1),
- tournament(Tour2,R2),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement