string A = "";
string B = "";
int sz;//存放色子数字
int i = 0;//用于处理色子循环投掷
int select=0;//用于接受用户的选择
int[] rp = new int[2];//用于记录是否踩雷
int[] zb=new int[2];//用于存储A和B的位置
Random c=new Random();
Console.WriteLine("请输入玩家A的姓名。");
A = Console.ReadLine();
while (A == "")
{
Console.WriteLine("输入姓名不能为空,请重新输入");
A = Console.ReadLine();
}
Console.WriteLine("请输入玩家B的姓名。");
B = Console.ReadLine();
while (B == "" || B == A)
{
if (B == "")
Console.WriteLine("输入不能为空,请重新输入");
else
Console.WriteLine("玩家B的姓名不能与A重复,请重新输入");
B = Console.ReadLine();
}
Console.Clear();
将特殊点(幸运轮盘 时空隧道 暂停 地雷)加入地图的函数,函数返回int类型数组赋给地图数组,输入三个参数分别为地图数组,特殊点数组,特殊点代表数字。
static int[] fuzhi(int[] a, int[] b, int c)
{
for (int i = 0; i < b.Length; i++)
a[b[i]] = c;
return a;
}
绘制地图的方法
static void huatu(int[] a, int b, int c)
{
for (int i = 0; i < 30; i++)
{
if (b == i && c == i)
Console.Write("<>");
else if (b == i && c != i)
Console.Write("A");
else if (b != i && c == i)
Console.Write("B");
else
{
switch (a[i])
{
case 0: Console.Write("□");
break;
case 1: Console.Write("◎");
break;
case 2: Console.Write("☆");
break;
case 3: Console.Write("▲");
break;
case 4: Console.Write("※");
break;
}
}
}
Console.WriteLine();
for (int i = 30; i < 35; i++)
{
if (b == i && c == i)
Console.WriteLine(" <>");
else if (b == i && c != i)
Console.WriteLine(" A");
else if (b != i && c == i)
Console.WriteLine(" B");
else
{
switch (a[i])
{
case 0: Console.WriteLine(" □");
break;
case 1: Console.WriteLine(" ◎");
break;
case 2: Console.WriteLine(" ☆");
break;
case 3: Console.WriteLine(" ▲");
break;
case 4: Console.WriteLine(" ※");
break;
}
}
}
for (int i = 64; i > 34; i--)
{
if (b == i && c == i)
Console.Write("<>");
else if (b == i && c != i)
Console.Write("A");
else if (b != i && c == i)
Console.Write("B");
else
{
switch (a[i])
{
case 0: Console.Write("□");
break;
case 1: Console.Write("◎");
break;
case 2: Console.Write("☆");
break;
case 3: Console.Write("▲");
break;
case 4: Console.Write("※");
break;
}
}
}
Console.WriteLine();
for (int i = 65; i < 70; i++)
{
if (b == i && c == i)
Console.WriteLine("<>");
else if (b == i && c != i)
Console.WriteLine("A");
else if (b != i && c == i)
Console.WriteLine("B");
else
{
switch (a[i])
{
case 0: Console.WriteLine("□");
break;
case 1: Console.WriteLine("◎");
break;
case 2: Console.WriteLine("☆");
break;
case 3: Console.WriteLine("▲");
break;
case 4: Console.WriteLine("※");
break;
}
}
}
for (int i = 70; i < 100; i++)
{
if (b == i && c == i)
Console.Write("<>");
else if (b == i && c != i)
Console.Write("A");
else if (b != i && c == i)
Console.Write("B");
else
{
switch (a[i])
{
case 0: Console.Write("□");
break;
case 1: Console.Write("◎");
break;
case 2: Console.Write("☆");
break;
case 3: Console.Write("▲");
break;
case 4: Console.Write("※");
break;
}
}
}
Console.WriteLine();
}