Skip to content

Commit

Permalink
Fixed 3p calculation in the case where there were only 2 different di…
Browse files Browse the repository at this point in the history
…ce values
  • Loading branch information
JerBoon committed Sep 18, 2019
1 parent e3d6618 commit f9a2c69
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/calc_scores.maxi_yatzy.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ calc_scores.maxi_yatzy <- function(game) {
t[t$section == "1p","score.available"] <- {if (x[1] >= 2) (max(as.integer(names(x)[x >= 2]))*2) else 0}
t[t$section == "2p","score.available"] <- (x[1] >= 2)*(length(x) > 1 & x[2] >= 2)*
(sum(as.integer(names(x)[1:2]))*2)
t[t$section == "3p","score.available"] <- (x[1] == 2)*(x[2] == 2)*(x[3] == 2)*
t[t$section == "3p","score.available"] <- (x[1] == 2)*(length(x) > 1 & x[2] == 2)*(length(x) > 2 & x[3] == 2)*
sum(game$dice)

#and then the staights..
Expand Down

0 comments on commit f9a2c69

Please sign in to comment.