示例#1
0
 public void MostrarGanador(string text, frm_Ejercicio8GUI form)
 {
     if (text == "X")
     {
         MessageBox.Show("Gana Jugador 1");
         ganadosJ1++;
         form.grb_Juego.Enabled = false;
     }
     else if (text == "O")
     {
         MessageBox.Show("Gana Jugador 2");
         ganadosJ2++;
         form.grb_Juego.Enabled = false;
     }
     else
     {
         MessageBox.Show("Empate");
         form.grb_Juego.Enabled = false;
     }
 }
示例#2
0
 public void ReiniciarJuego(frm_Ejercicio8GUI form)
 {
     form.btn_P1.Text    = "-";
     form.btn_P1.Enabled = true;
     form.btn_P2.Text    = "-";
     form.btn_P2.Enabled = true;
     form.btn_P3.Text    = "-";
     form.btn_P3.Enabled = true;
     form.btn_P4.Text    = "-";
     form.btn_P4.Enabled = true;
     form.btn_P5.Text    = "-";
     form.btn_P5.Enabled = true;
     form.btn_P6.Text    = "-";
     form.btn_P6.Enabled = true;
     form.btn_P7.Text    = "-";
     form.btn_P7.Enabled = true;
     form.btn_P8.Text    = "-";
     form.btn_P8.Enabled = true;
     form.btn_P9.Text    = "-";
     form.btn_P9.Enabled = true;
 }
示例#3
0
 public void Verificar(frm_Ejercicio8GUI form)
 {
     if (form.btn_P1.Text == form.btn_P2.Text && form.btn_P2.Text == form.btn_P3.Text && !form.btn_P1.Enabled)
     {
         MostrarGanador(form.btn_P1.Text, form);
     }
     else if (form.btn_P4.Text == form.btn_P5.Text && form.btn_P5.Text == form.btn_P6.Text && !form.btn_P4.Enabled)
     {
         MostrarGanador(form.btn_P4.Text, form);
     }
     else if (form.btn_P7.Text == form.btn_P8.Text && form.btn_P8.Text == form.btn_P9.Text && !form.btn_P7.Enabled)
     {
         MostrarGanador(form.btn_P7.Text, form);
     }
     else if (form.btn_P1.Text == form.btn_P4.Text && form.btn_P4.Text == form.btn_P7.Text && !form.btn_P1.Enabled)
     {
         MostrarGanador(form.btn_P1.Text, form);
     }
     else if (form.btn_P2.Text == form.btn_P5.Text && form.btn_P5.Text == form.btn_P8.Text && !form.btn_P2.Enabled)
     {
         MostrarGanador(form.btn_P2.Text, form);
     }
     else if (form.btn_P3.Text == form.btn_P6.Text && form.btn_P6.Text == form.btn_P9.Text && !form.btn_P3.Enabled)
     {
         MostrarGanador(form.btn_P3.Text, form);
     }
     else if (form.btn_P1.Text == form.btn_P5.Text && form.btn_P5.Text == form.btn_P9.Text && !form.btn_P1.Enabled)
     {
         MostrarGanador(form.btn_P1.Text, form);
     }
     else if (form.btn_P3.Text == form.btn_P5.Text && form.btn_P5.Text == form.btn_P7.Text && !form.btn_P3.Enabled)
     {
         MostrarGanador(form.btn_P3.Text, form);
     }
     else if (!form.btn_P1.Enabled && !form.btn_P2.Enabled && !form.btn_P3.Enabled && !form.btn_P4.Enabled && !form.btn_P5.Enabled && !form.btn_P6.Enabled && !form.btn_P7.Enabled && !form.btn_P8.Enabled && !form.btn_P9.Enabled)
     {
         MostrarGanador("-", form);
     }
 }