Exemplo n.º 1
0
        public Game(string startWord, PlayerBase startPlayer)
            : this()
        {
            Contract.Requires(string.IsNullOrEmpty(startWord));

              this.Id = Guid.NewGuid();
              this.GameGrid = new Collection<Cell>();
              this.PlayerLogs = new Collection<PlayerLog>();
              this.Players = new ObservableCollection<PlayerBase>();
              this.Players.CollectionChanged += this.Players_CollectionChanged;
              this.StartTime = DateTime.Now;
              this.StartWord = startWord.ToUpper(System.Globalization.CultureInfo.InvariantCulture);
              this.Players.Add(startPlayer);
              this.StartPlayer = startPlayer;
              this.CurrentPlayer = this.StartPlayer;
              this.InitGameGrid();
        }
Exemplo n.º 2
0
 public Game StartNewGame(int wordLength, PlayerBase player)
 {
     var game = new Game(this.GetStartWord(wordLength), player);
       this.Games.Add(game);
       return game;
 }
Exemplo n.º 3
0
        public void AddWord(PlayerBase player, GridWord word)
        {
            Contract.Requires(player == this.CurrentPlayer);

              var log = this.PlayerLogs.Single(l => l.Player == player);
              log.GridWords.Add(word);
              this.MoveToNextPlayer();
        }
Exemplo n.º 4
0
 public PlayerLog(PlayerBase player)
     : this()
 {
     this.Player = player;
       this.GridWords = new Collection<GridWord>();
 }