Beispiel #1
0
        /// <summary>
        /// Recherche si ligne Vertical dupliqué
        /// </summary>
        /// <param name="sudoku"></param>
        /// <returns></returns>
        public static bool NoDuplicateRowVerti(Sudoku sudoku)
        {
            HashSet <int[]> hashSet = new HashSet <int[]>();

            // premier élément
            hashSet.Add(sudoku.GetRowVertical(0));

            for (int i = 1; i < Sudoku.SIZE - 1; i++)
            {
                var r = sudoku.GetRowVertical(i);

                foreach (var hash in hashSet)
                {
                    // regarde si cette ligne existe déjà
                    if (RowUtil.RowEqual(r, hash))
                    {
                        // existe
                        return(false);
                    }
                }
            }

            hashSet = null;
            return(true);
        }