using System;
class MainClass
{
static void Main()
{
Dado clsDado = new Dado();
Jugador clsJugador = new Jugador();
Juego clsJuego = new Juego();
Random r = new Random();
int puntajePrimerJugador;
int puntajeSegundoJugador;
int puntajeTercerJugador;
//INICIANDO JUEGO
if (clsJuego.IniciarJuego())
{
Console.WriteLine("Iniciar Juego\n");
Console.WriteLine("Seleciona una opcion:Si No\n");
Console.WriteLine("Si\n");
Console.WriteLine("Cargando Juego. Por favor espere");
Console.Write("----------------------------------------------------------------------------------------------------\n");
Console.WriteLine("BIENVENIDOS A DADO'S GAME!!! :)\n");
Console.WriteLine("Ingrese el numero de jugadores: 3\n");
clsJugador.CantidadJugadores = 3;
Console.WriteLine("Ingrese el alias de los jugadores: ");
//ASIGNAMOS LA LISTA DE JUGADORES
string[] jugadores = { "Karina", "Angel", "Luis" };
clsJugador.ListaJugadores(jugadores); //SE IMPRIMEN LOS JUGADORE
do{
int SeleccionPrimerJugador = r.Next(1,7);
int SeleccionSegundoJugador = r.Next(1,7);
int SeleccionTercerJugador = r.Next(1,7);
Console.WriteLine("Ronda " +clsDado.Rondas);
Console.WriteLine("Karina elige un numero del dado: " + SeleccionPrimerJugador);
Console.WriteLine("Angel elige un numero del dado: " + SeleccionSegundoJugador);
Console.WriteLine("Luis elige un numero del dado: " + SeleccionTercerJugador);
//IMPRIMIR EL NUMERO DEL DADO
Console.WriteLine("El dado cayo en el numero: " +clsDado.LanzarDado());
if (clsDado.LanzarDado()==SeleccionPrimerJugador)
{
clsJuego.Ganador = "KARINA";
Console.WriteLine("FELICIDADES "+clsJuego.Ganador+" GANASTE ESTA RONDA");
}
if (clsDado.LanzarDado()==SeleccionSegundoJugador)
{
clsJuego.Ganador = "ANGEL";
Console.WriteLine("FELICIDADES "+clsJuego.Ganador+" GANASTE ESTA RONDA");
}
if (clsDado.LanzarDado()==SeleccionTercerJugador)
{
clsJuego.Ganador = "LUIS";
Console.WriteLine("FELICIDADES "+clsJuego.Ganador+" GANASTE ESTA RONDA");
}
if (clsDado.LanzarDado()!=SeleccionPrimerJugador && clsDado.LanzarDado()!= SeleccionSegundoJugador && clsDado.LanzarDado()!= SeleccionTercerJugador)
{
Console.WriteLine("TODOS HAN PERDIDO");
}
Console.WriteLine();
clsDado.Rondas++;
}while(clsDado.Rondas<16);
}
}
}
using System;
public class Dado
{
//PROPIEDADES
public int LadosDelDado = 0;
private int UltimoResultado = 0;
public int Rondas = 1;
//METODOS
private int GeneradorNumeros()
{
Random r = new Random();
return this.UltimoResultado = r.Next(1, 7);
}
public int LanzarDado()
{
return GeneradorNumeros();
}
}
using System;
using System.Collections.Generic;
public class Jugador
{
private int NumSeleccionado;
public int CantidadJugadores;
public bool JugarDeNuevo = true;
public int Puntaje=0;
public void ListaJugadores(string[] arr)
{
for (int i = 0; i < arr.Length; i++)
{
Console.Write(arr[i] + "{0}\n", i < arr.Length - 1 ? " " : "");
}
Console.WriteLine();
}
public int SeleccionarLado()
{
Random r = new Random();
return this.NumSeleccionado = r.Next(1,7);
}
}//fin clase
using System;
using System.Collections.Generic;
public class Juego
{
public bool InicioRonda=false;
private bool InicioJuego = false;
public string Ganador;
public bool IniciarJuego()
{
if (InicioJuego)
return false;
else return true;
}
}//fin clase