Random r = new Random (); Random definition of two persons
string[] S1 = new string[] {"Scissors", "stone", "cloth"};
string[] s2 = new string[] {"Scissors", "stone", "cloth"}; Randomly define an array of two people
String JG;
while (true)
{
int sj1 = R.next (0, 3); 0 for scissors, 1 for stone, 2 for cloth
int sj2 = R.next (0, 3);
if (sj1 = = sj2)
{
JG = "A Out is" + s1[sj1] + ", B out is" + s2[sj2] + ", the result is a draw";
}
else if (sj1 > Sj2)
{
if (sj1 = = 0 && sj2 = = 2)//If random 1 out of scissors, random 2 out of cloth
{
JG = "A out of is" + s1[sj1] + ", B out of is" + s2[sj2] + ", the result is B victory";
}
Else
{
JG = "A out of is" + s1[sj1] + ", B out of is" + s2[sj2 "+" result is a victory ";
}
}
Else
{
if (sj1 = = 2 && sj2 = = 0)//If random 1 out of cloth, random 2 out of scissors
{
JG = "A out of is" + s1[sj1] + ", B out of is" + s2[sj2] + ", the result is B victory";
}
Else
{
JG = "A out of is" + s1[sj1] + ", B out of is" + s2[sj2] + ", the result is B victory";
}
}
Console.WriteLine (JG);
Console.ReadLine ();
Example: stone scissors cloth. Do it with an array. More difficult to understand, mainly logical thinking