public void Init(IEnumerable<IPlayer> players) { Players = players.ToDictionary(p => p.Name, StringComparer.OrdinalIgnoreCase); States = Players.Values.ToDictionary(p => p, p => new PlayerState()); Table = new Table(); }
public GameState(IDeckFactory deckFactory, IEnumerable<Player> players) { this.deckFactory = deckFactory; this.players = players.ToArray(); Table = new Table(); states = this.players.ToDictionary(p => p, p => new State()); readOnlyStates = states.ToDictionary(kvp => kvp.Key, kvp => (IPlayerState)kvp.Value).AsReadOnly(); deck = deckFactory.CreateDeck(); }