コード例 #1
0
        // Unexpected finder pattern present in symbol
        // Eval condition: 1:1:3:1:1 ratio dark:light:dark:light:dark preceded or followed by light area 4 modules wide
        // Points: 40 points per occurrence
        private int CalculatePenaltyScoreC()
        {
            int numOccurrences = 0;

            for (int row = 0; row < Width; row++)
            {
                FinderPatternDetector detector = new FinderPatternDetector();
                for (int col = 0; col < Width; col++)
                {
                    bool currentModuleIsDark = _modules.IsDark(row, col);
                    detector.ShiftIn(currentModuleIsDark);
                }
                numOccurrences += detector.NumFinderPatternsFound;
            }

            for (int col = 0; col < Width; col++)
            {
                FinderPatternDetector detector = new FinderPatternDetector();
                for (int row = 0; row < Width; row++)
                {
                    bool currentModuleIsDark = _modules.IsDark(row, col);
                    detector.ShiftIn(currentModuleIsDark);
                }
                numOccurrences += detector.NumFinderPatternsFound;
            }

            return numOccurrences * 40;
        }