From f9a2c6993646efa01a3eaea6964582937c0e8846 Mon Sep 17 00:00:00 2001 From: Jer Boon Date: Wed, 18 Sep 2019 21:36:36 +0100 Subject: [PATCH] Fixed 3p calculation in the case where there were only 2 different dice values --- R/calc_scores.maxi_yatzy.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/calc_scores.maxi_yatzy.R b/R/calc_scores.maxi_yatzy.R index 3137ce3..3d692fa 100644 --- a/R/calc_scores.maxi_yatzy.R +++ b/R/calc_scores.maxi_yatzy.R @@ -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..