From 27e4f477b3b65dd0fde8ec60b5ec1aa5f3660094 Mon Sep 17 00:00:00 2001 From: Jeremy Boon Date: Fri, 20 Sep 2019 13:38:44 +0100 Subject: [PATCH] RELEASE 1.3.0 - Game now has "Maxi Yatzy" game option (with 6 dice to roll) --- DESCRIPTION | 2 +- NEWS.md | 7 ++++++- R/calc_scores.maxi_yatzy.R | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 75a211f..b7ce05c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: yahtzR Type: Package Title: Play variations of the well-known dice rolling game in an R session -Version: 1.2.1 +Version: 1.3.0 Author: Jer Boon Maintainer: Jer Boon Description: diff --git a/NEWS.md b/NEWS.md index d706ace..3faba48 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# yahtzR 1.3.0 + +Added "maxi_yatzy" game option - the game with 6 dice, and the ability to store +and use unused dice rolls later on.. + # yahtzR 1.2.0 Behind the scenes, much of the gamme variation related code is now implemented @@ -5,7 +10,7 @@ with S3 methods. Added game variations for Yatzy and a 4 dice variation of said. -"Long straight" nor relabled as "Large straight". +"Long straight" now relabled as "Large straight". Change to the argument calls for the yahtzR() function. Introduces a slight backward incompatibility to previous releases. Apologies to my zero users... diff --git a/R/calc_scores.maxi_yatzy.R b/R/calc_scores.maxi_yatzy.R index 3d692fa..fab1a00 100644 --- a/R/calc_scores.maxi_yatzy.R +++ b/R/calc_scores.maxi_yatzy.R @@ -34,7 +34,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) + (sum(as.integer(sort(names(x)[x >= 2], decreasing=T)[1:2]))*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)