static void Main(string[] args)
{
while (true)
{
int x, y;
Random r = new Random();
x = r.Next(0, 3);
y = r.Next(0, 3);
switch (x)
{
case 0:
Console.WriteLine("X是剪刀");
break;
case 1:
Console.WriteLine("X是石头");
break;
case 2:
Console.WriteLine("X是布");
break;
}
switch (y)
{
case 0:
Console.WriteLine("Y是剪刀");
break;
case 1:
Console.WriteLine("Y是石头");
break;
case 2:
Console.WriteLine("Y是布");
break;
}
Console.WriteLine("X="+x+"\tY="+y);
if (x==y)
{
Console.WriteLine("平局");
}
else if (x==0&&y==2||x>y)
{
Console.WriteLine("X获胜");
}
else if(x==2&&y==0||x<y)
{
Console.WriteLine("Y获胜");
}
Console.Read();
}
}