Esempio n. 1
0
 public bool WiseGoto(MazeNode.Direction from)
 {
     if (Goto(from))
     {
         return(true);
     }
     else
     {
         MazeNode           user       = map[userX, userY];
         MazeNode.Direction direction1 = from.ROL(1);
         MazeNode.Direction direction2 = from.ROL(3);
         MazeNode           node1      = GotoNode(user, direction1);
         MazeNode           node2      = GotoNode(user, direction2);
         if (node1 != null)
         {
             if (node2 != null)
             {
                 MazeNode node3 = GotoNode(node1, from);
                 MazeNode node4 = GotoNode(node2, from);
                 if (node3 != null && node4 == null)
                 {
                     return(Goto(direction1));
                 }
                 if (node3 == null && node4 != null)
                 {
                     return(Goto(direction2));
                 }
                 return(false);
             }
             else
             {
                 return(Goto(direction1));
             }
         }
         else
         {
             if (node2 != null)
             {
                 return(Goto(direction2));
             }
             else
             {
                 return(false);
             }
         }
     }
 }
Esempio n. 2
0
 public static MazeNode.Direction ROR(this MazeNode.Direction direction, int value)
 {
     return(direction.ROL(4 - value));
 }