/// <inheritdoc />
        public IEnumerator <object[]> GetEnumerator()
        {
            Reset();

            for (var i = 0; i < Count; i++, IncrementOne())
            {
                yield return(CurrentCombination.ToArray());
            }
        }
Example #2
0
 public void PressKey(string key)
 {
     //TODO: Log key press
     Analytics.LogKeyPress(key);
     CombinationSoFar += key;
     if (CombinationSoFar == CurrentCombination)
     {
         NewLevel();
     }
     if (!CurrentCombination.StartsWith(CombinationSoFar))
     {
         WrongKey();
     }
 }
Example #3
0
        public void Count()
        {
            int[] dices = new int[6];
            int[] check = new int[Combinations.Length];

            Combinations.CopyTo(check, 0);

            foreach (var dice in CurrentCombination)
            {
                dices[dice - 1]++;
            }

            int smStraight = 0, lgStraight = 0;

            for (int i = 0; i < 6; i++)
            {
                Combinations[i] = dices[i] * (i + 1);

                if (dices[i] >= 1)
                {
                    smStraight++;
                    lgStraight++;
                }
                else
                {
                    smStraight = 0;
                    lgStraight = 0;
                }

                if (dices[i] >= 3)
                {
                    Combinations[6] = CurrentCombination.Sum();

                    if (dices[i] == 3)
                    {
                        foreach (var dice in dices)
                        {
                            if (dice == 2)
                            {
                                Combinations[8] = 25;
                            }
                        }
                    }
                }

                if (dices[i] >= 4)
                {
                    Combinations[7] = CurrentCombination.Sum();
                }

                if (dices[i] == 5)
                {
                    Combinations[11] = 50;
                }
            }

            if (smStraight >= 4)
            {
                Combinations[9] = 30;
            }
            if (lgStraight == 5)
            {
                Combinations[10] = 40;
            }

            Combinations[12] = CurrentCombination.Sum();

            for (int i = 0; i < Combinations.Length; i++)
            {
                if (MaskCombinations[i])
                {
                    Combinations[i] = check[i];
                }
            }
        }