Last active
August 16, 2020 12:56
-
-
Save dietercastel/c72db3f25f1c3f4d5dc5eacefc49c84f to your computer and use it in GitHub Desktop.
Multiplayer Rock, Paper, Scissors win chance problog.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Rock, Paper, Scissors in problog. | |
% Editor URL: https://dtai.cs.kuleuven.be/problog/editor.html#task=prob&hash=462b1ed73475d1bbd67dbc1f6d503a4c | |
1/3::rock(X); 1/3::paper(X) ; 1/3::scissors(X) :- rps(X). | |
%1/5::rock(X); 1/5::paper(X) ; 1/5::scissors(X) ; 1/5::lizard(X); 1/5::spock(X) :- rpslk(X). | |
rps(X) :- between(1,11,X). | |
%rps(1). | |
%rps(2). | |
%rps(3). | |
%rpslk(4). | |
winsFrom(X,Y) :- rps(X), rock(X), rps(Y), scissors(Y), X \== Y. | |
winsFrom(X,Y) :- rps(X), scissors(X), rps(Y), paper(Y), X \== Y. | |
winsFrom(X,Y) :- rps(X), paper(X), rps(Y), rock(Y), X \== Y. | |
stalemate(X,Y,Z) :- rock(X), paper(Y), scissors(Z), X \== Y, Y \== Z, X \== Z. | |
stalemateChance :- stalemate(X,Y,Z). | |
winChance :- \+ stalemate(X,Y,Z). | |
%query(winsFrom(_,_)). | |
%query(stalemate(_,_,_)). | |
query(stalemateChance). | |
query(winChance). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment