Пример #1
0
        public static TwoPoint CheckAvailablePath()
        {
            pointList.Clear();
            TwoPoint result = new TwoPoint(new Point(0, 0), new Point(0, 0));

            for (int i = 1; i < 9; i++)
            {
                for (int j = 1; j < 16; j++)
                {
                    if (arr[i, j] != -1)
                    {
                        pointList.Add(new Point(i, j));
                    }
                }
            }

            for (int i = 0; i < pointList.Count - 1; i++)
            {
                for (int j = i + 1; j < pointList.Count; j++)
                {
                    if (arr[pointList[i].X, pointList[i].Y] == arr[pointList[j].X, pointList[j].Y])
                    {
                        findpath(pointList[i], pointList[j]);
                        if (lineList.Count > 0)
                        {
                            result.p1 = pointList[i];
                            result.p2 = pointList[j];
                            return(result);
                        }
                    }
                }
            }
            return(result);
        }
Пример #2
0
 private void CheckPath()
 {
     result = Matrix.CheckAvailablePath();
     if (!result.p1.Equals(nullp) && !result.p2.Equals(nullp))
     {
     }
     else
     {
         while (result.p1.Equals(nullp) && result.p2.Equals(nullp))
         {
             Matrix.RefreshMatrix();
             result = Matrix.CheckAvailablePath();
         }
         LoadImage();
     }
 }