Exemplo n.º 1
0
 public GameService(IGameFactory gameFactory, bool disableBotTimeout)
 {
     this.gameFactory       = gameFactory;
     this.disableBotTimeout = disableBotTimeout;
     currentIpvBGame        = null;
     CurrentBoardState      = null;
 }
Exemplo n.º 2
0
        public void StopGame()
        {
            if (currentIpvBGame != null)
            {
                NewBoardStateAvailable?.Invoke(null);

                currentIpvBGame.StopGame();

                currentIpvBGame.DebugMessageAvailable   -= OnDebugMessageAvailable;
                currentIpvBGame.NextBoardstateAvailable -= OnNextBoardstateAvailable;
                currentIpvBGame.WinnerAvailable         -= OnWinnerAvailable;

                currentIpvBGame = null;
            }
        }
Exemplo n.º 3
0
        public void CreateGame(IQuoridorBot uninitializedBot, string botName, GameConstraints gameConstraints, string initialProgress)
        {
            if (currentIpvBGame != null)
            {
                StopGame();
            }

            currentIpvBGame = disableBotTimeout
                                                                        ? gameFactory.CreateNewGame(uninitializedBot,
                                                                                                    botName,
                                                                                                    new GameConstraints(Timeout.InfiniteTimeSpan,
                                                                                                                        gameConstraints.MaximalMovesPerPlayer),
                                                                                                    initialProgress)
                                                                        : gameFactory.CreateNewGame(uninitializedBot,
                                                                                                    botName,
                                                                                                    gameConstraints,
                                                                                                    initialProgress);

            currentIpvBGame.DebugMessageAvailable   += OnDebugMessageAvailable;
            currentIpvBGame.NextBoardstateAvailable += OnNextBoardstateAvailable;
            currentIpvBGame.WinnerAvailable         += OnWinnerAvailable;
        }