public CustomBasicList <CustomBasicList <bool> > RollDice(int howManySections = 7)
        {
            if (DiceList.Count == 0)
            {
                throw new BasicBlankException("There are no dice to even roll.  Try FirstLoad");
            }
            int counts = DiceList.Count(Items => Items.Value == false);
            CustomBasicList <CustomBasicList <bool> > output = new CustomBasicList <CustomBasicList <bool> >();

            AsyncDelayer.SetDelayer(this, ref _delay !);
            IDiceContainer <bool> thisG = MainContainer !.Resolve <IDiceContainer <bool> >();

            thisG.MainContainer = MainContainer;
            CustomBasicList <bool> possList = thisG.GetPossibleList;

            howManySections.Times(() =>
            {
                CustomBasicList <bool> firsts = new CustomBasicList <bool>();
                counts.Times(() =>
                {
                    firsts.Add(possList.GetRandomItem());
                });
                output.Add(firsts);
            });
            return(output);
        }
示例#2
0
        public void RollDice()
        {
            Log.AppendLine(string.Format(Constants.WHOS_TURN_IS_IT_MSG, GameManager.CurrentPlayer.Name, DiceList.Count));

            foreach (Dice dice in DiceList)
            {
                Thread.Sleep(10);
                int sideId = new System.Random().Next(1, 7);
                dice.ChooseSide(sideId);

                Log.AppendLine(string.Format(Constants.AFTER_ROLLING_DICES_MSG, dice.ID, dice.AfterRolledSide));
            }

            ChipsManager.MoveChips();

            int dotDiceCount = DiceList.Count(d => d.AfterRolledSide.ToUpper() == Constants.DOT);

            if (dotDiceCount == DiceList.Count)
            {
                Log.AppendLine(string.Format(Constants.KEEPING_CHIPS_MSG));
            }
            else
            {
                Log.AppendLine(string.Format(Constants.MOVING_CHIPS_MSG));
            }

            WinnerChecker.Check(GameManager, Log);
        }
示例#3
0
    public int Change(DieSide oldSide, DieSide newSide, int count, bool cannotBeRerolled = false, bool cannotBeModified = false)
    {
        var changedDiceCount = 0;

        if (count == 0) // change all
        {
            changedDiceCount += ChangeDice(oldSide, newSide, false, cannotBeRerolled, cannotBeModified);
        }
        else
        {
            count = Math.Min(count, DiceList.Count(n => n.Side == oldSide));
            for (int i = 0; i < count; i++)
            {
                changedDiceCount += ChangeDice(oldSide, newSide, true, cannotBeRerolled, cannotBeModified);
            }
        }

        UpdateDiceCompareHelperPrediction();
        return(changedDiceCount);
    }
示例#4
0
    public int Change(DieSide oldSide, DieSide newSide, int count = 0, bool cannotBeRerolled = false, bool cannotBeModified = false)
    {
        var changedDiceCount = 0;

        if (count == 0) // = change all
        {
            changedDiceCount += ChangeAll(oldSide, newSide, cannotBeRerolled, cannotBeModified);
        }
        else
        {
            changedDiceCount = Math.Min(count, DiceList.Count(n => n.Side == oldSide));
            for (int i = 0; i < changedDiceCount; i++)
            {
                ChangeOne(oldSide, newSide, cannotBeRerolled, cannotBeModified);
            }
        }

        OrganizeDicePositions();
        return(changedDiceCount);
    }
示例#5
0
 private int HowMany()
 {
     return(_saveRoot !.DiceList.Count(Items => Items.Value == _saveRoot.WhatNumber));
 }