temporalio / samples-php

Temporal PHP SDK samples
Other
88 stars 40 forks source link

55 allowing for repeated pairs in update dice scoring #56

Closed vid-n3t closed 1 month ago

vid-n3t commented 2 months ago

What was changed

Fixes issue #55 Quick change to the update sample to allow for repeated pairs in 3 matched pairs dice scoring.

Why?

It's a good demo and fun little game of Zonk, so I just wanted to fix this bug so it doesn't distract from the point of the sample.

Checklist

  1. Closes #55

  2. How was this tested: 2.1. Pretest: Modify app/src/Updates/Zonk/Dice.php to force 1 or 2 number variations total.

    diff --git a/app/src/Updates/Zonk/Dice.php b/app/src/Updates/Zonk/Dice.php
    index 216d37a..1b95da6 100644
    --- a/app/src/Updates/Zonk/Dice.php
    +++ b/app/src/Updates/Zonk/Dice.php
    @@ -37,6 +37,6 @@ final class Dice
    
     private function roll(): int
     {
    -        return $this->value = \random_int(1, 6);
    +        return $this->value = \random_int(3, 4); //force 3's and 4's to increase the likelyhood of 3 pairs of repeated pairs: 3,3; 4,4; 4,4;
     }
    }

    2.2. Play the game until you have 3 matched pairs. In this test case, two or more pairs will repeat. 2.3. Select all pairs. 2.4. Expected result: "Your total score is 750 (+750)"

CLAassistant commented 2 months ago

CLA assistant check
All committers have signed the CLA.

CLAassistant commented 2 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

vid-n3t commented 1 month ago

Closing after discussion in #55 If I understand correctly the current behavior is expected and it works as designed. If you ever want to change that, FWIW. we could re-open the PR.