/// <summary>
        /// Creates the sheet object which contains the coordinates of the blobs.
        /// Performs scanning and validity on the recorded Choice/Numbers.
        /// </summary>
        /// <param name="blobs"></param>
        public static char[] get_answers(Sheet sheet, List<BLOB> blobs)
        {
            char[] answers = new char[100]; // Array of answers.

            // Scanning A choices.
            CHOICE[] A = new CHOICE[100];
            int ch = 0;
            for (int a = 0; a < 100; ++a)
            {
                A[a] = sheet.choices[ch];
                ch += 4;
            }
            for (int i = 0; i < 100; ++i)
            {
                if (scan_blobs(A[i].coordinate, blobs))
                    if (check_validity(answers[i]))
                        answers[i] = 'A';
                    else
                        answers[i] = '0';
            }
            
            // Scanning B choices.
            CHOICE[] B = new CHOICE[100];
            ch = 1;
            for (int a = 0; a < 100; ++a)
            {
                B[a] = sheet.choices[ch];
                ch += 4;
            }
            for (int i = 0; i < 100; ++i)
            {
                if (scan_blobs(B[i].coordinate, blobs))
                    if (check_validity(answers[i]))
                        answers[i] = 'B';
                    else
                        answers[i] = '0';
            }
            
            
            // Scanning C choices.
            CHOICE[] C = new CHOICE[100];
            ch = 2;
            for (int a = 0; a < 100; ++a)
            {
                C[a] = sheet.choices[ch];
                ch += 4;
            }
            for (int i = 0; i < 100; ++i)
            {
                if (scan_blobs(C[i].coordinate, blobs))
                    if (check_validity(answers[i]))
                        answers[i] = 'C';
                    else
                        answers[i] = '0'; 
            }
            
            // Scanning D choices.
            CHOICE[] D = new CHOICE[100];
            ch = 3;
            for (int a = 0; a < 100; ++a)
            {
                D[a] = sheet.choices[ch];
                ch += 4;
            }
            for (int i = 0; i < 100; ++i)
            {
                if (scan_blobs(D[i].coordinate, blobs))
                    if (check_validity(answers[i]))
                        answers[i] = 'D';
                    else
                        answers[i] = '0'; 
            }
            
            return answers;

        }
Esempio n. 2
0
        /// <summary>
        /// Creates the sheet object which contains the coordinates of the blobs.
        /// Performs scanning and validity on the recorded Choice/Numbers.
        /// </summary>
        /// <param name="blobs"></param>
        public static char[] get_answers(Sheet sheet, List <BLOB> blobs)
        {
            char[] answers = new char[100]; // Array of answers.

            // Scanning A choices.
            CHOICE[] A  = new CHOICE[100];
            int      ch = 0;

            for (int a = 0; a < 100; ++a)
            {
                A[a] = sheet.choices[ch];
                ch  += 4;
            }
            for (int i = 0; i < 100; ++i)
            {
                if (scan_blobs(A[i].coordinate, blobs))
                {
                    if (check_validity(answers[i]))
                    {
                        answers[i] = 'A';
                    }
                    else
                    {
                        answers[i] = '0';
                    }
                }
            }

            // Scanning B choices.
            CHOICE[] B = new CHOICE[100];
            ch = 1;
            for (int a = 0; a < 100; ++a)
            {
                B[a] = sheet.choices[ch];
                ch  += 4;
            }
            for (int i = 0; i < 100; ++i)
            {
                if (scan_blobs(B[i].coordinate, blobs))
                {
                    if (check_validity(answers[i]))
                    {
                        answers[i] = 'B';
                    }
                    else
                    {
                        answers[i] = '0';
                    }
                }
            }


            // Scanning C choices.
            CHOICE[] C = new CHOICE[100];
            ch = 2;
            for (int a = 0; a < 100; ++a)
            {
                C[a] = sheet.choices[ch];
                ch  += 4;
            }
            for (int i = 0; i < 100; ++i)
            {
                if (scan_blobs(C[i].coordinate, blobs))
                {
                    if (check_validity(answers[i]))
                    {
                        answers[i] = 'C';
                    }
                    else
                    {
                        answers[i] = '0';
                    }
                }
            }

            // Scanning D choices.
            CHOICE[] D = new CHOICE[100];
            ch = 3;
            for (int a = 0; a < 100; ++a)
            {
                D[a] = sheet.choices[ch];
                ch  += 4;
            }
            for (int i = 0; i < 100; ++i)
            {
                if (scan_blobs(D[i].coordinate, blobs))
                {
                    if (check_validity(answers[i]))
                    {
                        answers[i] = 'D';
                    }
                    else
                    {
                        answers[i] = '0';
                    }
                }
            }

            return(answers);
        }