コード例 #1
0
        private bool CheckMoveMade(int row, int column, int number, SudokuPattern pattern)
        {
            if (this.Moves.Count == 0)
            {
                return(false);
            }

            int count = 0;

            foreach (SudokuMove move in this)
            {
                count++;
                int nextCount = 0;

                foreach (SudokuMove nextMove in this)
                {
                    nextCount++;
                    if (Object.ReferenceEquals(move, nextMove))
                    {
                        continue;
                    }

                    if (SudokuSolver.Compare(move.Rows, nextMove.Rows) && SudokuSolver.Compare(move.Columns, nextMove.Columns) && SudokuSolver.Compare(move.Numbers, nextMove.Numbers) && move.Pattern == nextMove.Pattern)
                    {
                        return(true);
                    }
                }
            }

            foreach (SudokuMove move in this)
            {
                if (move.Pattern == pattern && move.Rows.Contains(row) && move.Columns.Contains(column) && move.Numbers.Contains(number))
                {
                    return(true);
                }
            }

            return(false);
        }