예제 #1
0
        public DrawOrWonGame OnOngoingGame(Func <IPlayerXsTurn <DrawOrWonGame>, DrawOrWonGame> ongoingFunc)
        {
            if (ongoingFunc == null)
            {
                throw new ArgumentNullException(nameof(ongoingFunc));
            }

            if (_wonGame != null)
            {
                _wonGame.NotifyWin();
                return(new DrawOrWonGame(_wonGame));
            }
            return(ongoingFunc(_ongoingGame));
        }
        public GameAfterSeventhMoveOrWonGame OnOngoingGame(Func <IPlayerXsTurn <GameAfterSeventhMoveOrWonGame>, GameAfterSeventhMoveOrWonGame> ongoingFunc)
        {
            if (ongoingFunc == null)
            {
                throw new ArgumentNullException(nameof(ongoingFunc));
            }

            if (_wonGame != null)
            {
                _wonGame.NotifyWin();
                return(new GameAfterSeventhMoveOrWonGame(_wonGame));
            }
            return(ongoingFunc(_ongoingGame));
        }
        public void OnDrawGame(Action <DrawGame> drawAction)
        {
            if (drawAction == null)
            {
                throw new ArgumentNullException(nameof(drawAction));
            }

            if (_wonGame != null)
            {
                _wonGame.NotifyWin();
                return;
            }
            drawAction(_drawGame);
        }