Ejemplo n.º 1
0
        public PlaceCardAction(PlacementCard card, int premise, int index)
            : base(card)
        {
            this.card = card;

            if (premise < 0)
            {
                throw new ArgumentOutOfRangeException("premise");
            }

            this.premise = premise;

            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index");
            }

            this.index = index;
        }
Ejemplo n.º 2
0
        public GameState PlaceCardAt(PlacementCard card, int premise, int index)
        {
            if (this.isRoundOver)
            {
                throw new InvalidOperationException("The round is over.");
            }

            var proof = (from p in this.proof
                         select p.ToList()).ToArray();

            proof[premise].Insert(index, card);

            return new GameState(
                this.game,
                this.playerIds,
                this.deck,
                this.scores,
                this.hands,
                this.dealer,
                this.turn,
                proof.Select(p => p.AsReadOnly()).ToList().AsReadOnly(),
                this.isRoundOver);
        }