Exemplo n.º 1
0
        /// <inheritdoc/>
        public void CheckWinner(IWinDetector winDetector)
        {
            // если уже есть победитель
            Winner = winDetector.GetWinner(this);
            if (Winner != null)
            {
                IsGameOver = true;
                End?.Invoke(Winner);
            }

            // Если всё поле закончилось
            if (_gameMoves.Count == Size * Size)
            {
                IsGameOver = true;
                End?.Invoke(null);
            }
        }
Exemplo n.º 2
0
 public ComputerPlayer(IWinDetector winDetector, IScenarioCalculator scenarioCalculator)
 {
     _winDetector        = winDetector ?? throw new ArgumentNullException(nameof(winDetector));
     _scenarioCalculator = scenarioCalculator ?? throw new ArgumentNullException(nameof(scenarioCalculator));
 }
Exemplo n.º 3
0
 public ScenarioCalculator(IWinDetector winDetector)
 {
     _winDetector = winDetector ?? throw new ArgumentNullException(nameof(winDetector));
 }