Пример #1
0
        public static RiskyPickGameBoard Create(List <int> caseValues)
        {
            if (NumberOfCases != caseValues.Count)
            {
                throw new ArgumentOutOfRangeException("You must have 24 cases in Risky Pick");
            }
            var newBoard = new RiskyPickGameBoard();
            var i        = 0;
            var cases    = caseValues
                           .OrderBy(cv => Guid.NewGuid())
                           .Select(e => GameCase.Create(++i, e))
                           .ToList();

            cases.ForEach(c => newBoard.Cases[c.CaseNumber] = c);
            return(newBoard);
        }
Пример #2
0
        public RiskyPickGameBoard Clone()
        {
            var newBoard = new RiskyPickGameBoard
            {
                Offer          = Offer?.Clone(),
                CurrentRound   = CurrentRound,
                _selectedCases = _selectedCases,
            };

            foreach (var i in Cases.Keys)
            {
                newBoard.Cases[i] = Cases[i].Clone();
            }
            if (PlayersCase != null)
            {
                newBoard.PlayersCase = newBoard.Cases[PlayersCase.CaseNumber];
            }
            return(newBoard);
        }