Closed vid-n3t closed 1 month ago
Hi. Sorry for the delay.
Farkle has many variations with different rules. The variation implemented in the example (Zonk) implies that four identical dice and a pair of others cannot form "three pairs".
I found rules where four identical dice can form "three pairs," but in this version, the prize points for other denominations are different.
Q. I rolled four-of-a-kind and a pair. What is my score? A. 1500 points. Four of a kind would be 1000, but if you're lucky enough to pair up the other two dice, it's actually three pairs even though four dice are identical. https://web.archive.org/web/20110812072301/http://www.pocketfarkel.com/frequentquestions.html
Thanks for doing the deep dive @roxblnfk!
So I suppose it works as designed then, and I'll close the bug and PR.
Either way, it was a fun tangent to dig into!
What are you really trying to do?
Correct the logic in the 'Update' sample's dice scoring code, to allow for multiple pairs of the same number.
Describe the bug
When the rolled dice values result in 3 pairs and 2 or 3 pair are the same number, such as: 1,1; 2,2; 2,2; or 3,3; 3,3; 3,3;, the 'Three pairs' logic fails to allow for repeated pairs;
Minimal Reproduction
Run the update game until you have 3 pairs, and two or more pairs are repeated;
Select all pairs
Result: "Picked dice with value # has no score"
Expected result: "Your total score is 750 (+750)"
QA notes: For testing you can ensure this case by updating the
roll():
function in app/src/Updates/Zonk/Dice.php b/app/src/Updates/Zonk/Dice.php to return all one number or randomly assign two numbers:Environment/Versions
Additional context
Just a quick fix:
to allow for repeated pairs in the sample.