public void Setup() { this.sut = new SingleGameStateBridge(); this.ruleSettings = new GameLogic.RuleSettings() { BettelsAreAllowed = true, CountingType = GameLogic.CountingType.DecreasingPointsForAceToUnter, ExtraPointsForLastTrickInsteadOfFirst = true, ExtraPointsForOthersWhenGoingOut = true, ExtraPointsForSevenOfTrumps = false, GameType = GameLogic.GameType.FourPlayerCrossBinokelGame, ScoresWillBeRounded = true, SecondTrumpMustAlsoWin = true, SevenOfTrumpsCanBeMeldedAndDiscarded = false, SevensAreIncluded = false, }; }
/// <summary> /// Starts a new game with teh given rules and AI strategies. /// </summary> /// <param name="ruleSettings">The rules for the game.</param> /// <param name="aiStrategyTypes">The strategies for the computer players. Should contain null entries for human players.</param> public void StartNewGame(GameLogic.RuleSettings ruleSettings, List <string> aiStrategyTypes) { this.currentStateStack = new GameStateStack() { CreationInfo = new GameCreationInfo() { AIStrategyTypes = aiStrategyTypes, RandomSeed = Guid.NewGuid().GetHashCode(), RuleSettings = ruleSettings, Version = CurrentStateStackVersion, }, }; // TODO: Serialize state stack to a persistent location right away. // Prepare a new game with a random player being the dealer ////this.currentRNG = new Random(this.currentStateStack.CreationInfo.RandomSeed); ////var playerCount = ruleSettings.GameType == GameLogic.GameType.ThreePlayerGame ? 3 : 4; ////this.currentDealer = _currentRNG.Next(playerCount); this.currentDealer = 0; this.currentBidAmount = 0; this.stateBridge.PrepareNewGame(ruleSettings, this.currentDealer); // Connect events this.ConnectEvents(this.stateBridge.EventSource); // Start displaying the main menu in a new thread var stopRequested = false; var thread = new Thread(() => { while (!stopRequested) { var userAction = this.userInterface.DisplayMainMenu(); if (userAction == UI.MainMenuActions.StartGame) { // Set up the basic UI this.userInterface.PrepareTable(this.currentDealer); this.stateBridge.TriggerSink.SendTrigger(Common.GameTrigger.GameStarted); } } }); thread.Start(); }