/* This method makes the actual grid that is displayed on the form. It takes in the FindSampleGame form as
         * parameters and returns nothing */

        public void MakeGrid(FindSampleGame form)
        {
            pictureGrid = new Location[Rows][];
            for (int i = 0; i < Rows; i++)                  // Access rows
            {
                pictureGrid[i] = new Location[Columns];     // Sets a new lcoation on the picture grid row
            }
            for (int i = 0; i < Rows; i++)                  // Rows
            {
                for (int j = 0; j < Columns; j++)           // Columns
                {
                    Location pos = CalculatePosition(i, j); // Creates a new position on the grid
                    pictureGrid[i][j]         = new Location(pos.Row, pos.Column);
                    pictureGrid[i][j].picture = new PictureBox();

                    form.Controls.Add(pictureGrid[i][j].picture); // Adds the picture to the controls on the form
                }
            }
        }
示例#2
0
        /* This method Enters the game on a click and guessing game begins.
        * It takes in object sender and EventArgs e as parameters and returns nothing */
        private void enterButton_Click(object sender, EventArgs e)
        {
            bool shouldLoad = false; // Set the load to false
            int i = 0; // set i
            sampleGame = new FindSampleGame();

            /* Th following logic checks to see what type of anaylyzer is chosen through the use
             * of radio button and cases are created accordingly */

            AnalyzerChecked = "";
            if (fingerprintRadioButton.Checked)
            {
                AnalyzerChecked = "fingerprint";
            }
            else if (dnaAnalyzerRadioButton.Checked)
            {
                AnalyzerChecked = "dna";
            }
            else if (bloodAnalyzerRadioButton.Checked)
            {
                AnalyzerChecked = "blood";
            }
            else if (fiberAnalyzerRadioButton.Checked)
            {
                AnalyzerChecked = "fiber";
            }
            switch (AnalyzerChecked)
            {
                case "fingerprint":
                    {

                        if (!(Scan[i] is null) && Scan[i].IsComplete) // If both the locations are guessed correctly
                        {
                            AlreadyPlayed(); // Calls the already played method that prints a message

                        }
        /* Parameterized Constructor that takes in Location size which holds the Rows and Columns,
         *  sample location that holds the secret location and it calls the base class constructor
         *  that holds the basic grid size of rows and columns, sample locations and also the image.
         *  it also calls the abse class consructor that contains the size of row, column, sample location,
         *  name of the default image and the form iself
         */

        public FiberAnalyzer(Location size, Location[] sampleLocations, FindSampleGame form) : base(size.Row, size.Column, sampleLocations, "GridSquare.jpg", form)
        {
            EvidenceImage = "FiberPic.jpg"; // Name of the default image
        }
示例#4
0
        /* Parameterized Constructor that takes in Location size which holds the Rows and Columns,
         * sample location that holds the secret location and it calls the base class constructor
         * that holds the basic grid size of rows and columns, sample locations and also the image.
         * it also calls the abse class consructor that contains the size of row, column, sample location,
         * name of the default image and the form iself
         */

        public FingerprintAnalyzer(Location size, Location[] sampleLocations, FindSampleGame form) : base(size.Row, size.Column, sampleLocations, "GridSquare.jpg", form)
        {
            EvidenceImage = "fingerprint.jpg";
        }
示例#5
0
        /* Parameterized Constructor that takes in the size, sampleLocations and form and it calls the base class constructor
         *  that holds the basic grid size of rows and columns, sample locations, defualt image and the form */

        public DNAAnalyzer(Location size, Location[] sampleLocations, FindSampleGame form) : base(size.Row, size.Column, sampleLocations, "GridSquare.jpg", form)
        {
            MakeDeadCells();
            EvidenceImage = "DNA.jpg"; // Default image
        }
        /* Parameterized Constructor that takes in the size, sampleLocations and form and it calls the base class constructor
         * that holds the basic grid size of rows and columns, sample locations, defual image and the form */

        public BloodAnalyzer(Location size, Location[] sampleLocations, FindSampleGame form) : base(size, sampleLocations, form)
        {
            MakeDeadCells();
            KillCells(deadCells);
            EvidenceImage = "blood.jpg"; // Default image
        }
        /* parameterized constructed taking in rows, columns, locations of the previously generated secret
         * evidence locations, and the name of the evidence image, ending in a .png preferably and form as parameters.
         * Takes in rows, columns, sample locations, image name and form as parameters */

        public ScanAnalyzer(int a, int b, Location[] sampleLocations, string nameOfImage, FindSampleGame form)
        {
            IsComplete = false;        // sets the Iscomplete bool to false
            SetGrid(a, b);             // set the size of the grid

            samples = sampleLocations; // Sample Locations
            MakeGrid(form);            // Calling the make grid method
            form.analyzer = this;      // Sets the current form
        }