public PlayerManager(int numberOfPlayers)
 {
     this.PlayerList = new List <Player>();
     for (var i = 0; i < numberOfPlayers; ++i)
     {
         this.PlayerList.Add(new Player(EnumParse <MeepleColor> .IntToEnum(i)));
     }
 }
Example #2
0
            public GameRunner(List <TileComponent> tileComponents, int numberOfPlayers, int difficutly = 3)
            {
                var structureManager = new StructureManager(); // initializing structure manager to set min id's for structures to 10

                this.PlayerManager = new PlayerManager(numberOfPlayers);

                this.AI = new AI(difficulty: difficutly, gameRunner: this, meepleColor: EnumParse <MeepleColor> .IntToEnum(numberOfPlayers));
                // initializes AI player, as the last player with the last color, and speciffied difficulty

                System.Console.WriteLine("GameRunner start");
                this.GameBoard     = new GameBoard();
                this.UnplayedTiles = new List <Tile>();

                var tileComponentsArray = tileComponents.ToArray();
                var shuffler            = new Utils <TileComponent>();
                var randomWithSeed      = new Random();

                this.Random = randomWithSeed;

                shuffler.Shuffle(randomWithSeed, tileComponentsArray);
                tileComponents = tileComponentsArray.ToList();

                //tileComponents = tileComponents.OrderBy(i => Guid.NewGuid()).ToList(); // random is not the same for each session
                foreach (var tileComponent in tileComponents)
                {
                    this.UnplayedTiles.Add(new Tile(GameBoard, tileComponent, (-1, -1)));
                }
            }