public UserControlPrizeLevels()
        {
            InitializeComponent();
            plsObject = new PrizeLevels();

            plsID = null;

            //SetsUp the default 2 PrizeLevel
            UserControlPrizeLevel ucpl = new UserControlPrizeLevel();
            ucpl.addListener(this);
            Prizes.Children.Add(ucpl);
            plsObject.addPrizeLevel(ucpl.plObject);
            ucpl.plObject.prizeLevel=1;
            ucpl.CloseButton.IsEnabled = false;
            ucpl.CloseButton.Opacity = 0.0f;

            UserControlPrizeLevel ucpl2 = new UserControlPrizeLevel();
            ucpl2.OuterGrid.Margin = new Thickness(0, Prizes.Children.Count * MARGIN, 0, 0);
            ucpl2.addListener(this);
            Prizes.Children.Add(ucpl2);
            plsObject.addPrizeLevel(ucpl2.plObject);
            ucpl2.plObject.prizeLevel = Prizes.Children.Count;
            ucpl2.CloseButton.IsEnabled = false;
            ucpl2.CloseButton.Opacity = 0.0f;

            this.Loaded += new RoutedEventHandler(UserControlPrizeLevels_Loaded);
            prizeLevelScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            prizeLevelCounterLabel.Content = Prizes.Children.Count;
        }
Esempio n. 2
0
        private PrizeLevels createPrizeLevels()
        {
            PrizeLevels prizes = new PrizeLevels();
            PrizeLevel A1 = new PrizeLevel();
            A1.numCollections = 1;
            A1.prizeLevel = 0;
            A1.isBonusGame = true;
            prizes.addPrizeLevel(A1);

            PrizeLevel A2 = new PrizeLevel();
            A2.numCollections = 1;
            A2.prizeLevel = 1;
            prizes.addPrizeLevel(A2);

            //PrizeLevel A3 = new PrizeLevel();
            //A3.numCollections = 3;
            //A3.prizeLevel = 3;
            //A3.isInstantWin = true;
            //prizes.addPrizeLevel(A3);

            //PrizeLevel A4 = new PrizeLevel();
            //A4.numCollections = 3;
            //A4.prizeLevel = 4;
            //prizes.addPrizeLevel(A4);

            return prizes;
        }
        public UserControlPrizeLevels()
        {
            InitializeComponent();
            plsObject = new PrizeLevels();

            plsID = null;

            //SetsUp the default 2 PrizeLevel
            UserControlPrizeLevel ucpl = new UserControlPrizeLevel();

            ucpl.addListener(this);
            Prizes.Children.Add(ucpl);
            plsObject.addPrizeLevel(ucpl.plObject);
            ucpl.plObject.prizeLevel   = 1;
            ucpl.CloseButton.IsEnabled = false;
            ucpl.CloseButton.Opacity   = 0.0f;

            UserControlPrizeLevel ucpl2 = new UserControlPrizeLevel();

            ucpl2.OuterGrid.Margin = new Thickness(0, Prizes.Children.Count * MARGIN, 0, 0);
            ucpl2.addListener(this);
            Prizes.Children.Add(ucpl2);
            plsObject.addPrizeLevel(ucpl2.plObject);
            ucpl2.plObject.prizeLevel   = Prizes.Children.Count;
            ucpl2.CloseButton.IsEnabled = false;
            ucpl2.CloseButton.Opacity   = 0.0f;

            this.Loaded += new RoutedEventHandler(UserControlPrizeLevels_Loaded);
            prizeLevelScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            prizeLevelCounterLabel.Content = Prizes.Children.Count;
        }
Esempio n. 4
0
        public void Test_Invalid_Add_Prize_Level()
        {
            PrizeLevels pls = new PrizeLevels();

            pls.addPrizeLevel(null);

            Assert.IsTrue(pls.getNumPrizeLevels() == 0);
        }
Esempio n. 5
0
        public void Test_Invalid_Remove_Prize_Level()
        {
            PrizeLevels pls = new PrizeLevels();

            pls.removePrizeLevel(5);

            Assert.IsTrue(pls.getNumPrizeLevels() == 0);
        }
Esempio n. 6
0
        private ITile createBoard(PrizeLevels prizes)
        {
            BoardGeneration bg = new BoardGeneration();
            int boardSize = 26;
            int initialReachable = 18;

            return bg.GenerateBoard(boardSize, initialReachable, 1, 6, 3, 2, prizes, 1, 2);
        }
Esempio n. 7
0
        public void Test_Add_Get_Prize_Level()
        {
            PrizeLevels pls = new PrizeLevels();

            PrizeLevel pl1 = new PrizeLevel();

            pls.addPrizeLevel(pl1);

            Assert.IsTrue(pl1.Equals(pls.getPrizeLevel(0)));
        }
Esempio n. 8
0
        public void Test_Invalid_Add_At_Prize_Level()
        {
            PrizeLevels pls = new PrizeLevels();
            PrizeLevel pl1 = new PrizeLevel();

            pls.addPrizeLevelAt(null, 0);
            pls.addPrizeLevelAt(pl1, 40);

            Assert.IsTrue(pls.getNumPrizeLevels() == 0);
        }
Esempio n. 9
0
        public void Test_Invalid_Level_Prize_Level()
        {
            PrizeLevels pls = new PrizeLevels();

            PrizeLevel pl1 = new PrizeLevel();

            pls.addPrizeLevel(pl1);

            Assert.IsTrue(pls.getLevelOfPrize(null) == -1);
        }
Esempio n. 10
0
        public void Test_Add_At_Prize_Level()
        {
            PrizeLevels pls = new PrizeLevels();

            PrizeLevel pl1 = new PrizeLevel();
            PrizeLevel pl2 = new PrizeLevel();

            pls.addPrizeLevel(pl1);
            pls.addPrizeLevelAt(pl2, 0);

            Assert.IsTrue(pls.getLevelOfPrize(pl2) == 0);
        }
Esempio n. 11
0
        public DivisionUC(PrizeLevels.PrizeLevels initialPrizeLevels, int number)
        {
            InitializeComponent();
            DivModel = new DivisionModel();
            setDataContextToModel();
            Prizes = initialPrizeLevels;
            DivModel.DivisionNumber = number;

            for (int i = 0; i < DivisionModel.MAX_PRIZE_BOXES; i++)
            {
                LevelBox levelBox = new LevelBox(i + 1);
                DivModel.levelBoxes.Add(levelBox);
                PrizeLevelBox box = new PrizeLevelBox(this, DivModel.levelBoxes[i]);
                if (i < initialPrizeLevels.getNumPrizeLevels()) box.levelModel.IsAvailable = true;
                prizeLevelsGrid.Children.Add(box);
            }
        }
Esempio n. 12
0
        public void personalGenBoardTest()
        {
            BoardGeneration bg = new BoardGeneration();
            int boardSize = 26;
            int initialReachable = 20;
            PrizeLevels prizes = new PrizeLevels();
            PrizeLevel A1 = new PrizeLevel();
            A1.numCollections = 3;
            A1.prizeLevel = 1;
            A1.isBonusGame = true;
            prizes.addPrizeLevel(A1);

            PrizeLevel A2 = new PrizeLevel();
            A2.numCollections = 3;
            A2.prizeLevel = 2;
            prizes.addPrizeLevel(A2);

            PrizeLevel A3 = new PrizeLevel();
            A3.numCollections = 3;
            A3.prizeLevel = 3;
            A3.isInstantWin = true;
            prizes.addPrizeLevel(A3);

            PrizeLevel A4 = new PrizeLevel();
            A4.numCollections = 3;
            A4.prizeLevel = 4;
            prizes.addPrizeLevel(A4);

            int numberOfExpectedCollection = 12;
            int numberOfExpectedMoveBack = 3;
            int numberOfExpectedMoveForward = 2;
            ITile firstTile = bg.GenerateBoard(boardSize, initialReachable, 2, 6, numberOfExpectedMoveBack, numberOfExpectedMoveForward, prizes, 1, 2);

            int numberOfCollection = 0;
            int numberOfMoveBack = 0;
            int numberOfMoveForward = 0;
            int numberOfextraGames = 0;
            int numberOfTiles = 0;
            ITile currentTile = firstTile;
            while (currentTile != null)
            {
                if (currentTile.Type == TileTypes.collection)
                {
                    numberOfCollection++;
                }
                else if (currentTile.Type == TileTypes.moveForward)
                {
                    numberOfMoveForward++;
                }
                else if (currentTile.Type == TileTypes.moveBack)
                {
                    numberOfMoveBack++;
                }
                else if (currentTile.Type == TileTypes.extraGame)
                {
                    numberOfextraGames++;
                }
                numberOfTiles++;
                currentTile = currentTile.Child;
            }
            string board = bg.ToString();
            Assert.IsTrue(numberOfCollection == numberOfExpectedCollection, "Number Of Collection Tiles not correct");
            Assert.IsTrue(numberOfMoveBack == numberOfExpectedMoveBack, "Number Of MoveBack Tiles not correct");
            Assert.IsTrue(numberOfMoveForward == numberOfExpectedMoveForward, "Number Of MoveForward Tiles not correct");
            Assert.IsTrue(boardSize == numberOfTiles, "Number Of Tiles not correct");
            if (board == "")
            {

            }
        }
        public void testBuildGameDataThreeDivisonsFourPicksWithLoss()
        {
            //Custom input for a game
            GameSetupModel gs = new GameSetupModel();
            gs.totalPicks = 4;

            PrizeLevel pl1 = new PrizeLevel();
            pl1.isInstantWin = false;
            pl1.numCollections = 3;
            pl1.prizeValue = 100;

            PrizeLevel pl2 = new PrizeLevel();
            pl2.isInstantWin = false;
            pl2.numCollections = 2;
            pl2.prizeValue = 50;

            PrizeLevel pl3 = new PrizeLevel();
            pl3.isInstantWin = false;
            pl3.numCollections = 2;
            pl3.prizeValue = 25;

            PrizeLevels pls = new PrizeLevels();
            pls.addPrizeLevel(pl1);
            pls.addPrizeLevel(pl2);
            pls.addPrizeLevel(pl3);

            DivisionModel dm1 = new DivisionModel();
            dm1.addPrizeLevel(pl1);
            dm1.MaxPermutations = 1000;

            DivisionModel dm2 = new DivisionModel();
            dm2.addPrizeLevel(pl2);
            dm2.MaxPermutations = 1000;

            DivisionModel dm3 = new DivisionModel();
            dm3.addPrizeLevel(pl2);
            dm3.addPrizeLevel(pl3);
            dm3.MaxPermutations = 1000;

            DivisionModel dm4 = new DivisionModel();
            dm4.MaxPermutations = 1000;

            DivisionsModel dms = new DivisionsModel();
            dms.addDivision(dm1);
            dms.addDivision(dm2);
            dms.addDivision(dm3);
            dms.addDivision(dm4);
            dms.LossMaxPermutations = 1000;

            //File Generator
            FileGenerationService fgs = new FileGenerationService();
            fgs.buildGameData(dms, pls, gs, "testBuildGameDataThreeDivisonsFourPicksWithLoss");
        }
        public void testBuildGameDataFiveDivisionsNinePicks()
        {
            GameSetupModel gs = new GameSetupModel();
            gs.totalPicks = 9;

            PrizeLevel pl1 = new PrizeLevel();
            pl1.isInstantWin = false;
            pl1.numCollections = 5;
            pl1.prizeValue = 100;

            PrizeLevel pl2 = new PrizeLevel();
            pl2.isInstantWin = false;
            pl2.numCollections = 4;
            pl2.prizeValue = 50;

            PrizeLevel pl3 = new PrizeLevel();
            pl3.isInstantWin = false;
            pl3.numCollections = 4;
            pl3.prizeValue = 25;

            PrizeLevel pl4 = new PrizeLevel();
            pl4.isInstantWin = false;
            pl4.numCollections = 3;
            pl4.prizeValue = 10;

            PrizeLevel pl5 = new PrizeLevel();
            pl5.isInstantWin = false;
            pl5.numCollections = 3;
            pl5.prizeValue = 5;

            PrizeLevels pls = new PrizeLevels();
            pls.addPrizeLevel(pl1);
            pls.addPrizeLevel(pl2);
            pls.addPrizeLevel(pl3);
            pls.addPrizeLevel(pl4);
            pls.addPrizeLevel(pl5);

            DivisionModel dm1 = new DivisionModel();
            dm1.addPrizeLevel(pl1);
            dm1.MaxPermutations = 1000;

            DivisionModel dm2 = new DivisionModel();
            dm2.addPrizeLevel(pl1);
            dm2.addPrizeLevel(pl2);
            dm2.MaxPermutations = 1000;

            DivisionModel dm3 = new DivisionModel();
            dm3.addPrizeLevel(pl1);
            dm3.addPrizeLevel(pl3);
            dm3.MaxPermutations = 1000;

            DivisionModel dm4 = new DivisionModel();
            dm4.addPrizeLevel(pl2);
            dm4.addPrizeLevel(pl3);
            dm4.MaxPermutations = 1000;

            DivisionModel dm5 = new DivisionModel();
            dm5.addPrizeLevel(pl4);
            dm5.addPrizeLevel(pl5);
            dm5.MaxPermutations = 1000;

            DivisionsModel dms = new DivisionsModel();
            dms.addDivision(dm1);
            dms.addDivision(dm2);
            dms.addDivision(dm3);
            dms.addDivision(dm4);
            dms.addDivision(dm5);
            dms.LossMaxPermutations = 1000;

            FileGenerationService fgs = new FileGenerationService();
            fgs.buildGameData(dms, pls, gs, "testBuildGameDataFiveDivisionsNinePicks");
        }
Esempio n. 15
0
        public void Test_Remove_Count_Prize_Level()
        {
            PrizeLevels pls = new PrizeLevels();

            PrizeLevel pl1 = new PrizeLevel();

            pls.addPrizeLevel(pl1);

            pls.removePrizeLevel(0);

            Assert.IsTrue(pls.getNumPrizeLevels() == 0);
        }
Esempio n. 16
0
        public void Test_Invalid_Get_Prize_Level()
        {
            PrizeLevels pls = new PrizeLevels();

            Assert.IsNull(pls.getPrizeLevel(1));
        }
        public void testBuildGameDataMaxDivison()
        {
            GameSetupModel gs = new GameSetupModel();
            gs.totalPicks = 20;

            int numPrizeLevels = 12;
            PrizeLevel[] prizes = new PrizeLevel[numPrizeLevels];
            PrizeLevels pls = new PrizeLevels();
            for (int i = 0; i < numPrizeLevels; i++)
            {
                prizes[i] = new PrizeLevel();
                prizes[i].isInstantWin = false;
                prizes[i].numCollections = i + 1;
                prizes[i].prizeValue = 100 * i;
                pls.addPrizeLevel(prizes[i]);
            }

            int numberOfDivions = 30;
            DivisionModel[] divisions = new DivisionModel[numberOfDivions];
            DivisionsModel dms = new DivisionsModel();
            dms.LossMaxPermutations = 30000;
            Random rand = new Random();
            for (int i = 0; i < numberOfDivions; i++)
            {
                divisions[i] = new DivisionModel();
                divisions[i].addPrizeLevel(prizes[rand.Next(0, 12)]);
                divisions[i].MaxPermutations = 30000;
                dms.addDivision(divisions[i]);
            }

            FileGenerationService fgs = new FileGenerationService();
            fgs.buildGameData(dms, pls, gs, "MaxTest");
        }