Non-transitive dice: Difference between revisions

Content added Content deleted
(Added R.)
m (→‎{{header|R}}: Changed variable name.)
Line 1,846: Line 1,846:
rowWinner <- ifelse(comparisonTable["X"] > comparisonTable["Y"], "X",
rowWinner <- ifelse(comparisonTable["X"] > comparisonTable["Y"], "X",
ifelse(comparisonTable["X"] == comparisonTable["Y"], "-", "Y"))
ifelse(comparisonTable["X"] == comparisonTable["Y"], "-", "Y"))
XWinCount <- sum(rowWinner == "X") - sum(rowWinner == "Y")
netXWins <- sum(rowWinner == "X") - sum(rowWinner == "Y")
if(XWinCount > 0) "X" else if(XWinCount == 0) "Draw" else "Y"
if(netXWins > 0) "X" else if(netXWins == 0) "Draw" else "Y"
}
}
rows <- seq_len(nrow(diceSet)) #Recall that each row of diceSet is a dice.
rows <- seq_len(nrow(diceSet)) #Recall that each row of diceSet is a dice.