コード例 #1
0
        public UtilityTests()
        {
            dice = new Dice();
            hat = "Hat";

            var banker = new Banker(new[] { hat });
            var propertyManager = new PropertyManager();
            electricCompany = new Utility(
                ClassicBoardFactory.ElectricCompanyIndex,
                ClassicBoardFactory.UtilityPrice,
                ClassicBoardFactory.UtilityGroup,
                banker,
                propertyManager,
                dice);

            waterWorks = new Utility(
                ClassicBoardFactory.WaterWorksIndex,
                ClassicBoardFactory.UtilityPrice,
                ClassicBoardFactory.UtilityGroup,
                banker,
                propertyManager,
                dice);

            propertyManager.ManageProperties(new[] { electricCompany, waterWorks });
        }
コード例 #2
0
        public static Game Create(IEnumerable<String> players)
        {
            var dice = new Dice();
            var banker = new Banker(players);
            var propertyManager = new PropertyManager();
            var properties = ClassicBoardFactory.CreateProperties(banker, propertyManager);
            propertyManager.ManageProperties(properties);

            var board = ClassicBoardFactory.CreateBoard(dice, new[] { new ClassicGoBonusRule(banker) }, properties, banker, players);
            var turnTaker = new ClassicTurn(dice, board, banker, propertyManager);

            return new Game(players, turnTaker, new GuidShuffler<String>());
        }
コード例 #3
0
        public static Board CreateBoard(Dice dice, IEnumerable<IMovementRule> movementRules, IEnumerable<Property> properties, Banker banker, IEnumerable<String> players)
        {
            var spaces = new List<Space>();
            var board = new Board(spaces, movementRules, players);

            var go = new Space(GoIndex);
            var communityChestOne = new Space(CommunityChestOneIndex);
            var incomeTax = new IncomeTax(IncomeTaxIndex, IncomeTaxPercentage, MaximumIncomeTaxPaymentAmount, banker);
            var chanceOne = new Space(ChanceOneIndex);
            var justVisiting = new Space(JustVisitingLocation);
            var communityChestTwo = new Space(CommunityChestTwoIndex);
            var freeParking = new Space(FreeParkingIndex);
            var chanceTwo = new Space(ChanceTwoIndex);
            var goToJail = new GoToJail(GoToJailIndex, JustVisitingLocation, board);
            var communityChestThree = new Space(CommunityChestThreeIndex);
            var chanceThree = new Space(ChanceThreeIndex);
            var luxuryTax = new LuxuryTax(LuxuryTaxIndex, LuxuryTaxPaymentAmount, banker);

            spaces.Add(go);
            spaces.Add(communityChestOne);
            spaces.Add(incomeTax);
            spaces.Add(chanceOne);
            spaces.Add(justVisiting);
            spaces.Add(communityChestTwo);
            spaces.Add(freeParking);
            spaces.Add(chanceTwo);
            spaces.Add(goToJail);
            spaces.Add(communityChestThree);
            spaces.Add(chanceThree);
            spaces.Add(luxuryTax);
            spaces.AddRange(properties);

            return board;
        }