예제 #1
0
        public void APlayerThatGetsTheGetOutOfJailFreeCardDoesntStayInJail()
        {
            var getOutOfJailFree = new GetOutOfJailFree(guard);
            var turns = new PlayerTurnCounter(players);
            dice.SetNumberToRoll(new[] { 15, 15, 4, 1 });
            var game = new Game(players, dice, board, turns, guard);

            getOutOfJailFree.Play(player1);
            game.TakeTurn(player1);

            Assert.That(board.GetPosition(player1), Is.EqualTo(15));
        }
예제 #2
0
        private Queue<ICard> CreateCommunityChestCards(Banker banker, Board board, PrisonGuard guard)
        {
            var christmasFund = new Collect(banker, 100);
            var inheritance = new Collect(banker, 100);
            var soldStock = new Collect(banker, 45);
            var bankError = new Collect(banker, 200);
            var receiveForServices = new Collect(banker, 25);
            var beautyContestWinnings = new Collect(banker, 10);
            var taxRefund = new Collect(banker, 20);
            var lifeInsurance = new Collect(banker, 100);

            var hospitalBill = new Pay(banker, 100);
            var doctorsFee = new Pay(banker, 50);
            var schoolTax = new Pay(banker, 150);

            var grandOpera = new CollectFromEachPlayer(banker, 50);
            var goToJail = new AdvanceTo(board, 30);
            var advanceToGo = new AdvanceTo(board, 0);
            var getOutOfJailFree = new GetOutOfJailFree(guard);

            var cards = new Queue<ICard>();
            cards.Enqueue(christmasFund);
            cards.Enqueue(inheritance);
            cards.Enqueue(soldStock);
            cards.Enqueue(bankError);
            cards.Enqueue(receiveForServices);
            cards.Enqueue(beautyContestWinnings);
            cards.Enqueue(taxRefund);
            cards.Enqueue(lifeInsurance);
            cards.Enqueue(hospitalBill);
            cards.Enqueue(doctorsFee);
            cards.Enqueue(schoolTax);
            cards.Enqueue(grandOpera);
            cards.Enqueue(goToJail);
            cards.Enqueue(advanceToGo);
            cards.Enqueue(getOutOfJailFree);

            return cards;
        }
예제 #3
0
        private Queue<ICard> CreateChanceCards(Banker banker, Board board, PrisonGuard guard, UtilityRentStrategy utilityRentStrtegy, RailroadRentStrategy railroadRentStrategy)
        {
            var bankDividend = new Collect(banker, 50);
            var maturedLoan = new Collect(banker, 150);
            var poorTax = new Pay(banker, 15);

            var moveToBoardwalk = new Advance(board, banker, 39);
            var rideTheReading = new Advance(board, banker, 5);
            var moveToIllinois = new Advance(board, banker, 24);
            var moveToStCharles = new Advance(board, banker, 11);
            var moveToNearestRailroad = new AdvanceToNearest(board, new[] { 5, 15, 25, 35 }, railroadRentStrategy);
            var MoveToNearest = new AdvanceToNearest(board, new[] { 12, 28 }, utilityRentStrtegy);
            var goBack3Spaces = new GoBackSpaces(board, 3);

            var chairmanOfTheboard = new PayEachPlayer(banker, 50);
            var goToJail = new AdvanceTo(board, 30);
            var advanceToGo = new AdvanceTo(board, 0);
            var getOutofJailFree = new GetOutOfJailFree(guard);

            var cards = new Queue<ICard>();
            cards.Enqueue(bankDividend);
            cards.Enqueue(maturedLoan);
            cards.Enqueue(poorTax);
            cards.Enqueue(moveToNearestRailroad);
            cards.Enqueue(moveToBoardwalk);
            cards.Enqueue(chairmanOfTheboard);
            cards.Enqueue(moveToNearestRailroad);
            cards.Enqueue(rideTheReading);
            cards.Enqueue(moveToIllinois);
            cards.Enqueue(moveToStCharles);
            cards.Enqueue(goToJail);
            cards.Enqueue(advanceToGo);
            cards.Enqueue(getOutofJailFree);

            return cards;
        }