int[,] map = new int[10, 10] //定义一个二维数组,十行十列
{
{1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,1,0,0,1},
{1,0,2,0,0,0,1,0,0,1},
{1,0,0,0,0,0,1,0,0,1},
{1,0,0,0,0,0,0,1,0,1},
{1,0,0,0,0,0,0,1,0,1},
{1,0,0,1,0,0,0,0,0,1},
{1,1,1,1,0,0,0,0,0,1},
{1,0,0,0,8,0,0,0,9,1},
{1,1,1,1,1,1,1,1,1,1},
};
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
if (map[i, j] == 1)
{
Console.Write("□");//墙壁
}
else if (map[i, j] == 0)
{
Console.Write(" ");
}
else if (map[i, j] == 2)
{
Console.Write("○");//箱子
}
else if (map[i,j]==9)
{
Console.Write("★");//把箱子推到的位置
}
else if (map [i,j]==8)
{
Console.Write("人");
}/把地图显示出来