internal LocalGamePvB(IQuoridorBot unInitializedBot, string botName, GameConstraints gameConstraints, string initialProgress) { quoridorBot = unInitializedBot; quoridorBot.DebugMessageAvailable += OnDebugMessageAvailable; humenMoves = new TimeoutBlockingQueue <Move>(200); gameLoopThreadPvB = new GameLoopThreadPvB(quoridorBot, botName, humenMoves, gameConstraints, initialProgress); gameLoopThreadPvB.NewBoardStateAvailable += OnNewBoardStateAvailable; gameLoopThreadPvB.WinnerAvailable += OnWinnerAvailable; new Thread(gameLoopThreadPvB.Run).Start(); }
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; }
public GameLoopThreadPvB(IQuoridorBot uninitializedBot, string botName, TimeoutBlockingQueue <Move> humenMoves, GameConstraints gameConstraints, string initialProgress) { bot = uninitializedBot; this.botName = botName; this.humenMoves = humenMoves; botMoves = new TimeoutBlockingQueue <Move>(200); bot.NextMoveAvailable += OnNextBotMoveAvailable; this.gameConstraints = gameConstraints; this.initialProgress = initialProgress; stopRunning = false; IsRunning = false; botTimer = new Timer(TimerTick, null, Timeout.Infinite, Timeout.Infinite); }
public GameLoopThreadBvB(IQuoridorBot bottomPlayerBot, IQuoridorBot topPlayerBot, BoardState initialBoardState, GameConstraints gameConstraints) { this.bottomPlayerBot = bottomPlayerBot; this.topPlayerBot = topPlayerBot; topPlayerBotMoves = new TimeoutBlockingQueue <Move>(200); bottomPlayerBotMoves = new TimeoutBlockingQueue <Move>(200); bottomPlayerBot.NextMoveAvailable += OnNextBottomPlayerBotMoveAvailable; topPlayerBot.NextMoveAvailable += OnNextTopPlayerBotMoveAvailable; currentBoardState = initialBoardState; this.gameConstraints = gameConstraints; stopRunning = false; IsRunning = false; bottomPlayerBotTimer = new Timer(TimerTickForBottomPlayerBot, null, Timeout.Infinite, Timeout.Infinite); topPlayerBotTimer = new Timer(TimerTickForTopPlayerBot, null, Timeout.Infinite, Timeout.Infinite); }
internal LocalGameBvB(IQuoridorBot uninitializedTopPlayerBot, IQuoridorBot uninitializedBottomPlayerBot, GameConstraints gameConstraints) { var topPlayer = new Player(PlayerType.TopPlayer); var bottomPlayer = new Player(PlayerType.BottomPlayer); topPlayerBot = uninitializedTopPlayerBot; topPlayerBot.Init(topPlayer.PlayerType, gameConstraints); topPlayerBot.DebugMessageAvailable += OnTopPlayerBotDebugMessageAvailable; bottomPlayerBot = uninitializedBottomPlayerBot; bottomPlayerBot.Init(bottomPlayer.PlayerType, gameConstraints); bottomPlayerBot.DebugMessageAvailable += OnBottomPlayerBotDebugMessageAvailable; var initialBoadState = BoardStateTransition.CreateInitialBoadState(topPlayer, bottomPlayer); gameLoopThreadBvB = new GameLoopThreadBvB(bottomPlayerBot, topPlayerBot, initialBoadState, gameConstraints); gameLoopThreadBvB.NewBoardStateAvailable += OnNewBoardStateAvailable; gameLoopThreadBvB.WinnerAvailable += OnWinnerAvailable; new Thread(gameLoopThreadBvB.Run).Start(); }
public void Init(PlayerType yourStartPosition, GameConstraints gameConstraints) { startPosition = yourStartPosition; }
public IBvBGame CreateNewGame(IQuoridorBot uninitializedBottomPlayerBot, IQuoridorBot uninitializedTopPlayerBot, GameConstraints gameConstraints) { return(new LocalGameBvB(uninitializedTopPlayerBot, uninitializedBottomPlayerBot, gameConstraints)); }
public IPvBGame CreateNewGame(IQuoridorBot uninitializedBot, string botName, GameConstraints gameConstraints, string intitialProgress) { return(new LocalGamePvB(uninitializedBot, botName, gameConstraints, intitialProgress)); }