protected static ProbableMove TryVertical(int Mode, int Star, string[] Cells, int size, int Index, int offset, string[] Pre, string[] Centers, string[] Post) { List <Word> Moves = new List <Word>(); int PreCount = Pre.Length; int PostCount = Post.Length; Point Pos = BoardUtil.Position(Index, size); string[] NewCells = (string[])Cells.Clone(); List <int> Impacted = new List <int>(); if (Pre.Length != 0) { for (int x = Pre.Length - 1; x >= 0; x--) { int cellIndex = BoardUtil.Abs(Pos.X - x, Pos.Y, size); Neighbor n = BoardUtil.FindNeighbors(cellIndex, size); if (n.Top != -1) { NewCells[n.Top] += Pre[x]; Impacted.Add(n.Top); if (Pre[x] == null) { continue; } Moves.Add(new Word { Tiles = Pre[x], Index = n.Top }); } else { return(new ProbableMove { Words = new List <ProbableWord>(), Direction = "V", Moves = new List <Word>() }); } } } if (Centers.Length != 0) { for (int c = 0; c < Centers.Length; c++) { int cellIndex = BoardUtil.Abs(Pos.X + c, Pos.Y, size); if (cellIndex == -1 || Centers[c] == "") { continue; } NewCells[cellIndex] += Centers[c]; Impacted.Add(cellIndex); if (Centers[c] == null) { continue; } Moves.Add(new Word { Tiles = Centers[c], Index = cellIndex }); } } if (Post.Length != 0) { for (int x = 0; x < Post.Length; x++) { int cellIndex = BoardUtil.Abs(Pos.X + offset + x, Pos.Y, size); Neighbor n = BoardUtil.FindNeighbors(cellIndex, size); if (n.Bottom != -1) { //string temp = Join(Post[x], Seperator); NewCells[n.Bottom] += Post[x]; Impacted.Add(n.Bottom); if (Post[x] == null) { continue; } Moves.Add(new Word { Tiles = Post[x], Index = n.Bottom }); } else { return(new ProbableMove { Words = new List <ProbableWord>(), Direction = "V", Moves = new List <Word>() }); } } } List <ProbableWord> W = new List <ProbableWord>(); if (Star < 0 || (Star >= 0 && NewCells[Star].Trim() != "")) { foreach (int index in Impacted) { W.AddRange(WordsAt(NewCells, size, index)); } } return(new ProbableMove { Mode = Mode, Words = W, Moves = Moves, Direction = "V" }); }