コード例 #1
0
        public void SetUp()
        {
            player1 = "Horse";
            player2 = "Car";
            players = new List<String> { player1, player2 };
            banker = new Banker(players, 1500);
            var purples = new List<RealEstate>();
            var purpleRentStrategy = new PropertyRentStrategy(purples);
            mediterranean = new RealEstate(banker, 60, 2, purpleRentStrategy);
            baltic = new RealEstate(banker, 60, 4, purpleRentStrategy);

            purples.AddRange(new[] { mediterranean, baltic });
        }
コード例 #2
0
        private Dictionary<Int32, IBoardSpace> CreateSpaces(Banker banker, Board board, IDice dice, PrisonGuard guard)
        {
            var purples = new List<RealEstate>();
            var purpleRentStrategy = new PropertyRentStrategy(purples);
            var mediterranean = new RealEstate(banker, 60, 2, purpleRentStrategy);
            var baltic = new RealEstate(banker, 60, 4, purpleRentStrategy);
            purples.AddRange(new[] { mediterranean, baltic });

            var lightBlues = new List<RealEstate>();
            var lightBlueRentStrategy = new PropertyRentStrategy(lightBlues);
            var oriental = new RealEstate(banker, 100, 6, lightBlueRentStrategy);
            var vermont = new RealEstate(banker, 100, 6, lightBlueRentStrategy);
            var connecticut = new RealEstate(banker, 120, 8, lightBlueRentStrategy);
            lightBlues.AddRange(new[] { oriental, vermont, connecticut });

            var violets = new List<RealEstate>();
            var violetRentStrategy = new PropertyRentStrategy(violets);
            var stCharlesPlace = new RealEstate(banker, 140, 10, violetRentStrategy);
            var states = new RealEstate(banker, 140, 10, violetRentStrategy);
            var virginia = new RealEstate(banker, 140, 12, violetRentStrategy);
            violets.AddRange(new[] { stCharlesPlace, states, virginia });

            var oranges = new List<RealEstate>();
            var orangeRentStrategy = new PropertyRentStrategy(oranges);
            var stJamesPlace = new RealEstate(banker, 180, 14, orangeRentStrategy);
            var tennessee = new RealEstate(banker, 180, 14, orangeRentStrategy);
            var newYork = new RealEstate(banker, 200, 16, orangeRentStrategy);
            oranges.AddRange(new[] { stJamesPlace, tennessee, newYork });

            var reds = new List<RealEstate>();
            var redRentStrategy = new PropertyRentStrategy(reds);
            var kentucky = new RealEstate(banker, 220, 18, redRentStrategy);
            var indiana = new RealEstate(banker, 220, 18, redRentStrategy);
            var illinois = new RealEstate(banker, 240, 20, redRentStrategy);
            reds.AddRange(new[] { kentucky, indiana, illinois });

            var yellows = new List<RealEstate>();
            var yellowRentStrategy = new PropertyRentStrategy(yellows);
            var atlantic = new RealEstate(banker, 260, 22, yellowRentStrategy);
            var ventor = new RealEstate(banker, 260, 22, yellowRentStrategy);
            var marvinGardens = new RealEstate(banker, 280, 24, yellowRentStrategy);
            yellows.AddRange(new[] { atlantic, ventor, marvinGardens });

            var greens = new List<RealEstate>();
            var greenRentStrategy = new PropertyRentStrategy(greens);
            var pacific = new RealEstate(banker, 300, 26, greenRentStrategy);
            var northCarolina = new RealEstate(banker, 300, 26, greenRentStrategy);
            var pennsylvaniaAvenue = new RealEstate(banker, 320, 28, greenRentStrategy);
            greens.AddRange(new[] { pacific, northCarolina, pennsylvaniaAvenue });

            var blues = new List<RealEstate>();
            var blueRentStrategy = new PropertyRentStrategy(blues);
            var parkPlace = new RealEstate(banker, 350, 35, blueRentStrategy);
            var boardwalk = new RealEstate(banker, 400, 50, blueRentStrategy);
            blues.AddRange(new[] { parkPlace, boardwalk });

            var railroads = new List<RealEstate>();
            var railroadRentStrategy = new RailroadRentStrategy(railroads);
            var readingRailroad = new RealEstate(banker, 200, 25, railroadRentStrategy);
            var pennsylvaniaRailroad = new RealEstate(banker, 200, 25, railroadRentStrategy);
            var bORailroad = new RealEstate(banker, 200, 25, railroadRentStrategy);
            var shortLineRailroad = new RealEstate(banker, 200, 25, railroadRentStrategy);
            railroads.AddRange(new[] { readingRailroad, pennsylvaniaRailroad, bORailroad, shortLineRailroad });

            var utilities = new List<RealEstate>();
            var utilityRentStrategy = new UtilityRentStrategy(utilities, dice);
            var electric = new RealEstate(banker, 150, 0, utilityRentStrategy);
            var water = new RealEstate(banker, 150, 0, utilityRentStrategy);
            utilities.AddRange(new[] { electric, water });

            var communityChestCards = CreateCommunityChestCards(banker, board, guard);
            var communityChest = new CardSpace(communityChestCards);

            var chanceCards = CreateChanceCards(banker, board, guard, utilityRentStrategy, railroadRentStrategy);
            var chance = new CardSpace(chanceCards);

            var spaces = new Dictionary<Int32, IBoardSpace>
            {
                { 0, new Go(banker) },
                { 1, mediterranean },
                { 2, communityChest },
                { 3, baltic },
                { 4, new IncomeTax(banker, 200, 10) },
                { 5, readingRailroad },
                { 6, oriental },
                { 7, chance },
                { 8, vermont },
                { 9, connecticut },
                { 11, stCharlesPlace },
                { 12, electric },
                { 13, states },
                { 14, virginia },
                { 15, pennsylvaniaRailroad },
                { 16, stJamesPlace },
                { 17, communityChest },
                { 18, tennessee },
                { 19, newYork },
                { 21, kentucky },
                { 22, chance },
                { 23, indiana },
                { 24, illinois },
                { 25, bORailroad },
                { 26, atlantic },
                { 27, ventor },
                { 28, water },
                { 29, marvinGardens },
                { 30, new GoToJail(board, 10, guard) },
                { 31, pacific },
                { 32, northCarolina },
                { 33, communityChest },
                { 34, pennsylvaniaAvenue },
                { 35, shortLineRailroad },
                { 36, chance },
                { 37, parkPlace },
                { 38, new LuxuryTax(banker, 75) },
                { 39, boardwalk }
            };

            return spaces;
        }