private void worldCanvas_MouseUp(object sender, MouseButtonEventArgs e)
        {
            int posX = (int)e.GetPosition(worldCanvas).X / ((int)worldCanvas.Width / maze.getWidth());
            int posY = (int)e.GetPosition(worldCanvas).Y / ((int)worldCanvas.Height / maze.getHeight());

            if ((bool)righthandPosRadio.IsChecked)
            {
                if (!maze.isBlock(posX, posY))
                {
                    righthandRunner.setPosition(posX, posY);
                    scene.render();
                }
            }
            else if ((bool)randomPosRadio.IsChecked)
            {
                if (!maze.isBlock(posX, posY))
                {
                    randomRunner.setPosition(posX, posY);
                    scene.render();
                }
            }
            else if ((bool)recursivePosRadio.IsChecked)
            {
                if (!maze.isBlock(posX, posY))
                {
                    recursiveRunner.setPosition(posX, posY);
                    scene.render();
                }
            }
        }
예제 #2
0
 public bool canMove(Position dir)
 {
     try
     {
         if (!maze.isBlock(position + dir))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }