示例#1
0
 //used to call a getRandomNum() on each button
 void GenerateRandom()
 {
     AnimalMath.GenerateRandomArrays();                  //reset random generation for new unique numbers
     for (int i = 0; i < AnimalMath.MAX_CHOICES; i++)
     {
         this.button[i] = AnimalMath.getRandomNum();     //retrieve unique random number to display
     }
 }
示例#2
0
 //this function runs when you click on the named object
 void Math_Answer_3_Click(object sender, RoutedEventArgs e)
 {
     if (AnimalMath.isAnswerCorrect(button[3]))
     {
         processRightAnswer(this.Math_Answer_3);
     }
     else
     {
         processWrongAnswer(this.Math_Answer_3);
     }
 }
示例#3
0
        BitmapImage chosenAnimal;                               //animal chosen to display
        //***************************************************************************************************


        //chooses a random animal from the model, creates random positions and places images randomely
        void generateImagePlacement()
        {
            animalPath   = animals.getAnimalIndex(AnimalMath.random.Next(animals.getSize())).getAnimalImage();
            chosenAnimal = new BitmapImage(animalPath);     //holds new image to be placed
            AnimalMath.GenerateRandomArrays();              //reset random generation for new unique numbers
            int position;                                   //position for animal to be placed in

            for (int k = 0; k < AnimalMath.correctAnswer; k++)
            {
                position = AnimalMath.getRandomNum();       //get new unique random integer
                placeImage(position, chosenAnimal);         //call function to place images within grid
            }
        }