Example #1
0
        public GameState(             
            IGameLog gameLog,
            IPlayerAction[] players,
            GameConfig gameConfig,
            Random random,
            IEnumerable<CardCountPair>[] startingDeckPerPlayer = null)
        {
            int playerCount = players.Length;
            this.gameLog = gameLog;
            this.cardGameSubset = gameConfig.cardGameSubset;
            this.supplyPiles = gameConfig.GetSupplyPiles(playerCount, random);
            this.nonSupplyPiles = gameConfig.GetNonSupplyPiles();

            this.mapCardToPile = new MapOfCards<PileOfCards>(this.cardGameSubset);
            this.BuildMapOfCardToPile();

            this.players = new PlayerCircle(playerCount, players, this.gameLog, random, this.cardGameSubset);

            this.hasPileEverBeenGained = new MapPileOfCardsToProperty<bool>(this.supplyPiles);
            this.pileEmbargoTokenCount = new MapPileOfCardsToProperty<int>(this.supplyPiles);
            this.trash = new BagOfCards(this.cardGameSubset);

            this.GainStartingCards(gameConfig);

            this.players.AllPlayersDrawInitialCards(gameConfig);

            foreach (PileOfCards cardPile in this.supplyPiles)
            {
                cardPile.ProtoTypeCard.DoSpecializedSetupIfInSupply(this);
            }
        }
Example #2
0
        public GameState(
            IPlayerAction[] playerActions,
            int[] playerPositions,
            Game game,
            IEnumerable <CardCountPair>[] startingDeckPerPlayer = null)
        {
            this.game = game;
            GameConfig gameConfig = game.GameConfig;

            int playerCount = playerActions.Length;

            this.supplyPiles    = gameConfig.GetSupplyPiles(playerCount, game.random);
            this.nonSupplyPiles = gameConfig.GetNonSupplyPiles();

            this.mapCardToPile = new MapOfCardsForGameSubset <PileOfCards>(this.CardGameSubset);
            this.BuildMapOfCardToPile();

            this.players = new PlayerCircle(playerCount, playerActions, playerPositions, game);

            this.hasPileEverBeenGained = new MapPileOfCards <bool>(this.supplyPiles);
            this.pileEmbargoTokenCount = new MapPileOfCards <int>(this.supplyPiles);
            this.trash = new BagOfCards(this.CardGameSubset);

            this.GainStartingCards(gameConfig);

            this.players.AllPlayersDrawInitialCards(gameConfig);

            foreach (PileOfCards cardPile in this.supplyPiles)
            {
                cardPile.ProtoTypeCard.DoSpecializedSetupIfInSupply(this);
            }
        }
Example #3
0
        public GameState(
            IPlayerAction[] playerActions,
            int[] playerPositions,
            Game game)
        {
            if (playerActions.Length != playerPositions.Length)
            {
                throw new Exception();
            }

            this.game = game;
            GameConfig gameConfig = game.GameConfig;

            this.emptyCardCollection = new CollectionCards(this.CardGameSubset, null);

            int playerCount = playerActions.Length;

            this.supplyPiles    = gameConfig.GetSupplyPiles(playerCount, game.random);
            this.nonSupplyPiles = gameConfig.GetNonSupplyPiles(playerCount);

            this.mapCardToPile = new MapOfCardsForGameSubset <PileOfCards>(this.CardGameSubset);
            this.BuildMapOfCardToPile();

            this.players = new PlayerCircle(playerCount, playerActions, playerPositions, game);

            this.hasPileEverBeenGained = new MapPileOfCards <bool>(this.supplyPiles);
            this.pileEmbargoTokenCount = new MapPileOfCards <int>(this.supplyPiles);
            this.trash = new BagOfCards(this.CardGameSubset);

            this.cardContextStack = new CardContextStack();

            this.GainStartingCards(gameConfig);

            foreach (PileOfCards cardPile in this.supplyPiles)
            {
                cardPile.ProtoTypeCard.DoSpecializedSetupIfInSupply(this);
            }

            this.players.AllPlayersDrawInitialCards(gameConfig, this);
        }
Example #4
0
        public GameState(                         
            IPlayerAction[] playerActions,
            int[] playerPositions,
            Game game)
        {
            if (playerActions.Length != playerPositions.Length)
                throw new Exception();

            this.game = game;
            GameConfig gameConfig = game.GameConfig;

            this.emptyCardCollection = new CollectionCards(this.CardGameSubset, null);

            int playerCount = playerActions.Length;
            this.supplyPiles = gameConfig.GetSupplyPiles(playerCount, game.random);
            this.nonSupplyPiles = gameConfig.GetNonSupplyPiles(playerCount);

            this.mapCardToPile = new MapOfCardsForGameSubset<PileOfCards>(this.CardGameSubset);
            this.BuildMapOfCardToPile();

            this.players = new PlayerCircle(playerCount, playerActions, playerPositions, game);

            this.hasPileEverBeenGained = new MapPileOfCards<bool>(this.supplyPiles);
            this.pileEmbargoTokenCount = new MapPileOfCards<int>(this.supplyPiles);
            this.trash = new BagOfCards(this.CardGameSubset);

            this.cardContextStack = new CardContextStack();

            this.GainStartingCards(gameConfig);

            foreach (PileOfCards cardPile in this.supplyPiles)
            {
                cardPile.ProtoTypeCard.DoSpecializedSetupIfInSupply(this);
            }

            this.players.AllPlayersDrawInitialCards(gameConfig, this);
        }