private List <BoardSquare> PrepareSolutionPath(BoardSquare start, BoardSquare finish)
        {
            List <BoardSquare> result = new List <BoardSquare>();

            BoardSquare temp = GetSmallestValueNeighbour(finish);

            result.Add(temp);

            while (!temp.Equals(start))
            {
                temp = GetSmallestValueNeighbour(temp);
                result.Add(temp);
            }

            result.Reverse();
            return(result);
        }
Beispiel #2
0
        public BoardSquare GetSpecificSquare(string text)
        {
            if (text != "0" && text != "F")
            {
                throw new InvalidOperationException("Only Start and Finish square info can be received");
            }
            if (!m_Square.Equals(BoardSquare.Null))
            {
                return(m_Square);
            }

            for (int i = 0; i < Size; i++)
            {
                for (int j = 0; j < Size; j++)
                {
                    if (GetContent(j, i) == text)
                    {
                        return(new BoardSquare(j, i));
                    }
                }
            }
            return(m_Square);
        }