Professional Documents
Culture Documents
Disparejo
Disparejo
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace Disparejo
{
class JuegoDisparejo
{
private static String[] moneda = new String[2] { "Sello", "Aguila" };
private static String[] r = new String[3];
public static void Jugador1()
{
Random rnd = new Random();
int x = rnd.Next(0, 2);
Console.WriteLine(moneda[x]);
r[0] = moneda[x];
Thread.Sleep(1000);
}
}
public static void Jugador3()
{
Random rnd = new Random();
int z = rnd.Next(0, 2);
Console.WriteLine(moneda[z]);
r[2] = moneda[z];
Thread.Sleep(1000);
}
static void Main(string[] args)
{
Thread Hilo1 = new Thread(Jugador1);
Thread Hilo2 = new Thread(Jugador2);
Thread Hilo3 = new Thread(Jugador3);
Hilo1.Start();
Hilo2.Start();
Hilo3.Start();
Hilo1.Join();
Hilo2.Join();
Hilo3.Join();