private bool VerifLignes() { char[] symbolesArray = Symboles.ToCharArray(); Array.Sort(symbolesArray); foreach (Case[] ligne in Cases) { char[] ligneValeur = new char[9]; for (int i = 0; i < ligne.Length; i++) { ligneValeur[i] = ligne[i].Valeur; } Array.Sort(ligneValeur); if (!Enumerable.SequenceEqual(symbolesArray, ligneValeur)) { return(false); } if (ligne.Length != 9) { return(false); } } return(true); }
private bool VerifSymboles() { foreach (Case[] t in Cases) { foreach (Case c in t) { if ((!Symboles.Contains(c.Valeur)) && (c.Valeur != '.')) { return(false); } if (c.Valeur == '.') { c.Hypotheses = Symboles; } else { c.Hypotheses = null; } } } return(true); }
private bool verifierUneRegionOK(char[,] tab, int iDepart, int iFin, int jDepart, int jFin) { bool reponse = true; List <char> tabControl = new List <char>(); for (int i = iDepart; i <= iFin; i++) { for (int j = jDepart; j <= jFin; j++) { tabControl.Add(tab[i, j]); } } char[] tabControlChar = tabControl.ToArray(); Array.Sort(tabControlChar); char[] symbolesArray = Symboles.ToCharArray(); Array.Sort(symbolesArray); if (!Enumerable.SequenceEqual(symbolesArray, tabControlChar)) { reponse = false; } return(reponse); }
private bool VerifColonnes() { List <Case[]> colonnes = new List <Case[]>(); for (int i = 0; i < 9; i++) { Case[] array = new Case[9]; for (int j = 0; j < 9; j++) { array[j] = cases[j][i]; } colonnes.Add(array); } foreach (Case[] colonne in colonnes) { char[] symbolesArray = Symboles.ToCharArray(); Array.Sort(symbolesArray); char[] ligneValeur = new char[9]; for (int i = 0; i < colonne.Length; i++) { ligneValeur[i] = colonne[i].Valeur; } Array.Sort(ligneValeur); if (!Enumerable.SequenceEqual(symbolesArray, ligneValeur)) { return(false); } if (colonne.Length != 9) { return(false); } } return(true); }
public void SetModule(Symboles s) { symboles = s; }