Esempio n. 1
0
 public bool IsExit(int i, int j)
 {
     if (!SceneTypeList.Contains(Grid[i, j]))
     {
         return(false);
     }
     if (Grid[i, j] == '↓')
     {
         if ((i - 1) > 0)
         {
             if (Grid[i - 1, j] == '║' || Grid[i - 1, j] == '╔' || Grid[i - 1, j] == '╗' || Grid[i - 1, j] == '╣' || Grid[i - 1, j] == '╠' || Grid[i - 1, j] == '╦' || Grid[i - 1, j] == '╬')
             {
                 return(true);
             }
         }
     }
     else if (Grid[i, j] == '←')
     {
         if ((j + 1) < GridSize)
         {
             if (Grid[i, j + 1] == '═' || Grid[i, j + 1] == '╝' || Grid[i, j + 1] == '╗' || Grid[i, j + 1] == '╣' || Grid[i, j + 1] == '╩' || Grid[i, j + 1] == '╦' || Grid[i, j + 1] == '╬')
             {
                 return(true);
             }
         }
     }
     else if (Grid[i, j] == '↑')
     {
         if ((i + 1) < GridSize)
         {
             if (Grid[i + 1, j] == '║' || Grid[i + 1, j] == '╚' || Grid[i + 1, j] == '╝' || Grid[i + 1, j] == '╣' || Grid[i + 1, j] == '╠' || Grid[i + 1, j] == '╩' || Grid[i + 1, j] == '╬')
             {
                 return(true);
             }
         }
     }
     else if (Grid[i, j] == '→')
     {
         if ((j - 1) > 0)
         {
             if (Grid[i, j - 1] == '═' || Grid[i, j - 1] == '╚' || Grid[i, j - 1] == '╔' || Grid[i, j - 1] == '╠' || Grid[i, j - 1] == '╩' || Grid[i, j - 1] == '╦' || Grid[i, j - 1] == '╬')
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 2
0
            public bool IsValid(int i, int j)
            {
                if (!SceneTypeList.Contains(Grid[i, j]))
                {
                    return(true);
                }
                if (IsEntry(i, j) || IsExit(i, j))
                {
                    return(true);
                }

                if (TopFacing.Contains(Grid[i, j]))
                {
                    if ((i - 1) > 0)
                    {
                        if (!DownFacing.Contains(Grid[i - 1, j]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (RightFacing.Contains(Grid[i, j]))
                {
                    if ((j + 1) < GridSize)
                    {
                        if (!LeftFacing.Contains(Grid[i, j + 1]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (DownFacing.Contains(Grid[i, j]))
                {
                    if ((i + 1) < GridSize)
                    {
                        if (!TopFacing.Contains(Grid[i + 1, j]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (LeftFacing.Contains(Grid[i, j]))
                {
                    if ((j - 1) > 0)
                    {
                        if (!RightFacing.Contains(Grid[i, j - 1]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }