/// <summary> /// Builds the player and adds it to given session /// </summary> /// <param name="toSession"> /// Session which player will added to. /// </param> /// <returns> /// <see cref="Player"/> /// </returns> /// <exception cref="InvalidOperationException"></exception> public Player Build(ISession toSession) { if (_player.Stones.Count(s => s is King) == 0) { throw new InvalidOperationException("Player has no King stone!"); } toSession.AddPlayer(_player); return(_player); }