static int GetStartIndex(string option, int r, int pos, int size, int move)
        {
            switch (option)
            {
            case "R":
                return(BoardUtil.Abs(r, pos - move, size));

            case "C":
                return(BoardUtil.Abs(pos - move, r, size));
            }
            return(-1);
        }
        static List <Word> GetWords(string[] Cells, string option, int r, int size, bool includeDuplicates)
        {
            List <Word> Words   = new List <Word>();
            var         pending = "";
            var         cnt     = 0;

            for (var i = 0; i < size; i++)
            {
                var index = -1;
                switch (option)
                {
                case "R":
                    index = BoardUtil.Abs(r, i, size);
                    break;

                case "C":
                    index = BoardUtil.Abs(i, r, size);
                    break;
                }
                var cell = Cells[index];
                if (cell != "")
                {
                    pending += "(" + cell + ")|";
                    cnt++;
                    continue;
                }
                if (pending != "" && cell == "")
                {
                    if (cnt > 1)
                    {
                        var word = pending.TrimEnd('|');
                        if (includeDuplicates)
                        {
                            int startIndex = GetStartIndex(option, r, i, size, cnt);
                            Words.Add(new Word {
                                Tiles = word, Syllables = cnt, Position = option, Index = startIndex
                            });
                        }
                        else
                        {
                            Word X = Words.Find(x => x.Tiles == word);
                            if (X == null)
                            {
                                int startIndex = GetStartIndex(option, r, i, size, cnt);
                                Words.Add(new Word {
                                    Tiles = word, Syllables = cnt, Position = option, Index = startIndex
                                });
                            }
                        }
                    }
                    pending = "";
                    cnt     = 0;
                    continue;
                }
            }
            if (cnt > 1)
            {
                var word = pending.TrimEnd('|');
                if (includeDuplicates)
                {
                    int startIndex = GetStartIndex(option, r, size, size, cnt);
                    Words.Add(new Word {
                        Tiles = word, Syllables = cnt, Position = option, Index = startIndex
                    });
                }
                else
                {
                    Word X = Words.Find(x => x.Tiles == word);
                    if (X == null)
                    {
                        int startIndex = GetStartIndex(option, r, size, size, cnt);
                        Words.Add(new Word {
                            Tiles = word, Syllables = cnt, Position = option, Index = startIndex
                        });
                    }
                }
            }
            return(Words);
        }
        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"
            });
        }