public static Location GetCurrentPlayerSpace(Square[,] map)
 {
     Location space = new Location();
     for (int i = 0; i< map.GetLength(0); i++)
     {
         for (int j = 0; j < map.GetLength(1); j++)
         {
             if (map[i,j].Piece == "Man")
             {
                 space.X = j;
                 space.Y = i;
                 break;
             }
         }
     }
     return space;
 }
 public static bool IsValidMove(Location nextspace, string direction, Square[,] map)
 {
     //check out of bounds
     if (nextspace.X < 0 || nextspace.Y < 0 || nextspace.X > map.GetLength(1) || nextspace.Y > map.GetLength(0))
     {
         return false;
     }
     //check if hitting wall
     if (map[nextspace.Y,nextspace.X].Space == "Wall")
     {
         return false;
     }
     //check if pushing crate against a wall
     if (IsPushingCrate(nextspace, map))
     {
         var nextcratespace = GetNextSpace(nextspace, direction);
         if (map[nextcratespace.Y,nextcratespace.X].Space == "Wall" || IsPushingCrate(nextcratespace, map))
         {
             return false;
         }
     }
     return true;
 }