[Solved] c# best way to match yahtzee


You’ll need a little loop:

public bool Yahtzee()
{
     // check if all dobbelstenen[int] are the same
     for(int i = 1; i < 5; i++) // start with second dobbelstenen
     {
          if(dobbelstenen[i] != dobbelstenen[0]) return false;
     }
     return true;
}

It simply compares second, third, … against the first.

1

solved c# best way to match yahtzee