Non-transitive dice: Difference between revisions
Content added Content deleted
ReeceGoding (talk | contribs) (Added R.) |
ReeceGoding (talk | contribs) 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")) |
||
netXWins <- sum(rowWinner == "X") - sum(rowWinner == "Y") |
|||
if( |
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. |