Example #1
0
        public ResolvedGrain RandomizedResolvedGrain()
        {
            ResolvedGrain chosenGrain = null;

            while (true)
            {
                chosenGrain = resolvedGrains.RandomElement();
                if (distinctResolvedGrainsCount <= 1)
                {
                    break;
                }
                if (repeatMode == RepeatSelectMode.NeverLastHalf)
                {
                    if (!recentlyPlayedResolvedGrains.Where((ResolvedGrain g) => g.Equals(chosenGrain)).Any())
                    {
                        break;
                    }
                }
                else if (repeatMode != RepeatSelectMode.NeverTwice || !chosenGrain.Equals(lastPlayedResolvedGrain))
                {
                    break;
                }
            }
            return(chosenGrain);
        }
Example #2
0
        public ResolvedGrain RandomizedResolvedGrain()
        {
            ResolvedGrain chosenGrain = null;

            for (;;)
            {
                chosenGrain = this.resolvedGrains.RandomElement <ResolvedGrain>();
                if (this.distinctResolvedGrainsCount <= 1)
                {
                    break;
                }
                if (this.repeatMode == RepeatSelectMode.NeverLastHalf)
                {
                    if (!(from g in this.recentlyPlayedResolvedGrains
                          where g.Equals(chosenGrain)
                          select g).Any <ResolvedGrain>())
                    {
                        break;
                    }
                }
                else if (this.repeatMode != RepeatSelectMode.NeverTwice || !chosenGrain.Equals(this.lastPlayedResolvedGrain))
                {
                    break;
                }
            }
            return(chosenGrain);
        }
Example #3
0
        public ResolvedGrain RandomizedResolvedGrain()
        {
            ResolvedGrain chosenGrain = null;

            goto IL_000d;
IL_000d:
            while (true)
            {
                chosenGrain = resolvedGrains.RandomElement();
                if (distinctResolvedGrainsCount <= 1)
                {
                    break;
                }
                if (repeatMode == RepeatSelectMode.NeverLastHalf)
                {
                    if (!(from g in recentlyPlayedResolvedGrains
                          where g.Equals(chosenGrain)
                          select g).Any())
                    {
                        break;
                    }
                }
                else if (repeatMode != RepeatSelectMode.NeverTwice || !chosenGrain.Equals(lastPlayedResolvedGrain))
                {
                    break;
                }
            }
            return(chosenGrain);

IL_008f:
            goto IL_000d;
        }
Example #4
0
 internal bool <> m__0(ResolvedGrain g)
 {
     return(g.Equals(this.chosenGrain));
 }