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(); }
public Game StartNewGame(int wordLength, PlayerBase player) { var game = new Game(this.GetStartWord(wordLength), player); this.Games.Add(game); return game; }
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(); }
public PlayerLog(PlayerBase player) : this() { this.Player = player; this.GridWords = new Collection<GridWord>(); }