private void DoColumn2(Word3 column2, Word3Grid grid, Action <Word3Grid> onFound) { if (this.allowDuplicateWords || (!grid.Row1.Equals(column2) && !grid.Column1.Equals(column2) && !grid.Row2.Equals(column2))) { grid = new Word3Grid(grid.Row1, grid.Row2, new Word3(grid.A20, column2.L3, '\0')); this.trie.Match2(grid.A20, grid.A21, w => this.DoRow3(w, grid, onFound)); } }
private void DoColumn1(Word3 column1, Word3Grid grid, Action <Word3Grid> onFound) { if (this.allowDuplicateWords || !grid.Row1.Equals(column1)) { grid = new Word3Grid(grid.Row1, new Word3(column1.L2, '\0', '\0'), new Word3(column1.L3, '\0', '\0')); this.trie.Match1(grid.A10, w => this.DoRow2(w, grid, onFound)); } }
public static void Load(string line, Action <Word3> onWordFound) { foreach (string s in line.Split(WhitespaceChars, StringSplitOptions.RemoveEmptyEntries)) { if (s.Length == 3) { Word3 word = new Word3(s); onWordFound(word); } } }
private void DoRow3(Word3 row3, Word3Grid grid, Action <Word3Grid> onFound) { grid = new Word3Grid(grid.Row1, grid.Row2, row3); if (this.allowDuplicateWords || (!grid.Row1.Equals(row3) && !grid.Column1.Equals(row3) && !grid.Row2.Equals(row3) && !grid.Column2.Equals(row3) && !grid.Column3.Equals(row3))) { if (this.trie.Contains(grid.Column3)) { onFound(grid); } } }
public Word3Grid(Word3 row1, Word3 row2, Word3 row3) { this.a00 = row1.L1; this.a01 = row1.L2; this.a02 = row1.L3; this.a10 = row2.L1; this.a11 = row2.L2; this.a12 = row2.L3; this.a20 = row3.L1; this.a21 = row3.L2; this.a22 = row3.L3; }
public void Find(Word3 input, Action <Word3Grid> onFound) { Word3Grid grid = new Word3Grid(input, new Word3(), new Word3()); this.trie.Match1(grid.A00, w => this.DoColumn1(w, grid, onFound)); }