static void Main(string[] args) { Program Damas = new Program(); Ficha[] fichas; Jugador [] jugadores = new Jugador[] { new Jugador("Blanco", 15), new Jugador("Rojo", 4) }; Tablero tablero; Partida partida; bool estadoJuego = true; while (estadoJuego) { switch (Damas.Menu()) { case 1: //la variable estado define si la partida esta en curso(true) o terminó (false) bool estado = true; String tipo = "o"; int dimX = 8; int dimY = 8; int nFichas = 24; int[] posX = new int[] { 1, 3, 5, 7, 2, 4, 6, 8, 1, 3, 5, 7, 2, 4, 6, 8, 1, 3, 5, 7, 2, 4, 6, 8 }; int[] posY = new int[] { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8 }; fichas = new Ficha[24]; //color 4 = rojo oscuro - color 15 = blanco - color 12 = rojo for (int i = 0; i < nFichas; i++) { String color = "4"; if (i < (fichas.Length / 2)) { color = "15"; } fichas[i] = new Ficha(color, tipo, posX[i], posY[i]); } tablero = new Tablero(dimX, dimY, fichas); partida = new Partida(tablero, jugadores, estado); partida.Iniciar(); while (partida.Estado) { partida.ContinuarPartida(); } Console.WriteLine("Ganador de la partida: Participante " + partida.Ganador.ToString()); break; case 2: break; default: Console.WriteLine("hasta luego!"); estadoJuego = false; break; } } }
public Tablero(Partida partida) { matriz = new Piezas[10, 10]; //----------------------------------------------------------- todo null for (int X = 0; X < 10; X++) { for (int Y = 0; Y < 10; Y++) { matriz[Y, X] = null; } } //----------------------------------------------------------- fichas Negras for (int X = 0; X < 10; X++) { for (int Y = 0; Y < 4; Y++) { if (X == 0 || X == 2 || X == 4 || X == 6 || X == 8 || X == 10) { if (Y == 0 || Y == 2) { matriz[Y, X] = new Piezas(partida.Jugador1); } } if (X == 1 || X == 3 || X == 5 || X == 7 || X == 9) { if (Y == 1 || Y == 3) { matriz[Y, X] = new Piezas(partida.Jugador1); } } } } //----------------------------------------------------------- fichas Rojas for (int X = 0; X < 10; X++) { for (int Y = 6; Y < 10; Y++) { if (X == 0 || X == 2 || X == 4 || X == 6 || X == 8 || X == 10) { if (Y == 6 || Y == 8) { matriz[Y, X] = new Piezas(partida.Jugador2); } } if (X == 1 || X == 3 || X == 5 || X == 7 || X == 9) { if (Y == 7 || Y == 9) { matriz[Y, X] = new Piezas(partida.Jugador2); } } } } }
private static void MostrarPartida(Partida Partida, Dibujador dibujador) { dibujador.Dibujar(Partida); }
//--------------------------------------------------------------------------------------------- private static void Inicializar() { Partida = new Partida(nombre1, nombre2, coordenada); dibujador = new Dibujador(); }