Example #1
0
        internal Game DeepCopy()
        {
            Game copy = new Game();

            copy.NumberOfPlayers = NumberOfPlayers;
            copy.ActivePlayer    = ActivePlayer;
            copy.LastTilePlaced  = LastTilePlaced;
            copy.TileBag         = TileBag.DeepCopy();
            copy.Players.Clear();
            foreach (var item in Players)
            {
                copy.Players.Add(item.DeepCopy());
            }
            copy.Board.Clear();
            foreach (var item in Board)
            {
                copy.Board.Add(item.DeepCopy());
            }
            copy.Hotels.Clear();
            foreach (var item in Hotels)
            {
                copy.Hotels.Add(item.DeepCopy());
            }

            return(copy);
        }
Example #2
0
 internal void Prepare(TileBag tileBag)
 {
     TileBag.Clear();
     for (int i = 0; i < 6; i++)
     {
         var tile = tileBag.Take().Value;
         TileBag.Add(tile);
     }
 }
Example #3
0
        internal TileBag DeepCopy()
        {
            var result = new TileBag();

            result.Tiles.Clear();
            foreach (var item in Tiles)
            {
                result.Tiles.Add(item);
            }
            return(result);
        }
Example #4
0
 public Game()
 {
     TileBag = new TileBag();
     Players = new List <Player>();
     Board   = new List <Tile>();
     Hotels  = new List <Hotel>();
     for (int i = 0; i < 6; i++)
     {
         Players.Add(new Player()
         {
             Index = i
         });
     }
     Reset();
     for (int i = 0; i < Defaults.HotelCount; i++)
     {
         Hotels.Add(new Hotel()
         {
             Property = (HotelEnum)i
         });
     }
 }