Anonymous user
Rock-paper-scissors: Difference between revisions
→{{header|Rascal}}
Line 1,578:
<lang rascal>import Prelude;
rel[str, str] whatbeats = {<"Rock", "
list[str]
str CheckWinner(a, b){
Line 1,591:
public str RPS(human){
computer = getOneFrom(
x = if(human == "Rock") "Paper"; elseif(human == "Paper") "
ComputerChoices += x;
return "Computer played <computer>. <CheckWinner(human, computer)> wins!";
}</lang>
Line 1,604:
rascal>RPS("Rock")
str: "Computer played
rascal>RPS("Rock")
|