Beispiel #1
0
        public override void Play(DosGame game)
        {
            while (game.CurrentPlayer == this && !game.CurrentState.IsFinished)
            {
                var moveResult = ChooseMove(game);

                if (moveResult.IsSuccess)
                {
                    continue;
                }

                if (moveResult.HasMessage)
                {
                    game.PublicLog(moveResult.Message);
                }
                game.PublicLog($"*Something went wrong, {Name} quits*");
                game.Quit(this);
                return;
            }

            if (CanBeCalledOut)
            {
                game.CallDos(this);
            }
        }
Beispiel #2
0
        public void ShouldNotCallDos_AfterMatchingTwoCardsWhileHavingThree()
        {
            game = new DosGame(new NonShufflingDealer(TwentyGreenSharps), 1, 3);
            game.Start();
            game.MatchCenterRowCard(Player0, GreenSharp, GreenSharp, GreenSharp);

            game.CallDos(Player0).ShouldBeFail();
        }
Beispiel #3
0
        public void CanCallDos_AfterHavingTwoCards()
        {
            game = new DosGame(new NonShufflingDealer(TwentyGreenSharps), 1, 3);
            game.Start();
            game.MatchCenterRowCard(Player0, GreenSharp, GreenSharp);

            game.CallDos(Player0).ShouldBeSuccess();
        }
Beispiel #4
0
        public void ShouldCallDos_AfterTurnEnd()
        {
            game = new DosGame(new NonShufflingDealer(TwentyGreenSharps), 2, 3);
            game.Start();
            game.MatchCenterRowCard(Player0, GreenSharp, GreenSharp);
            game.AddCardToCenterRow(Player0, GreenSharp);
            game.EndTurn(Player0);

            game.CallDos(Player0).ShouldBeSuccess();
        }
Beispiel #5
0
        public void ShouldNotCallDos_AfterNextPlayerMadeAMove()
        {
            game = new DosGame(new NonShufflingDealer(TwentyGreenSharps), 2, 3);
            game.Start();
            game.MatchCenterRowCard(Player0, GreenSharp, GreenSharp);
            game.AddCardToCenterRow(Player0, GreenSharp);
            game.EndTurn(Player0);

            game.Draw(Player1);
            game.CallDos(Player1).ShouldBeFail();
        }