Codigo De Un Simple Juego De 3 En Linea, Para Gambas!

Código: Seleccionar todo

' Gambas class file

PUBLIC SUB Form_Open()
  WITH TextBox1
    .Text = "Nombre Jugador 1"
    .Height = "27"
    .Width = "190"
    .X = "10"
    .Y = "10"
  END WITH
  WITH TextBox2
    .Text = "Nombre Jugador 2"
    .Height = "27"
    .Width = "190"
    .X = "10"
    .Y = "40"
  END WITH
  WITH Button10
    .Text = "Aceptar"
    .Height = "27"
    .Width = "85"
    .X = "205"
    .y = "10"
  END WITH
  WITH ME
    .Center
    .Height = "310"
    .Width = "310"
  END WITH
  WITH Button1
    .Text = ""
    .Enabled = FALSE
    .X = "56"
    .Y = "90"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Button2
    .Text = ""
    .Enabled = FALSE
    .X = "130"
    .Y = "90"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Button3
    .Text = ""
    .Enabled = FALSE
    .X = "204"
    .Y = "90"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Button4
    .Text = ""
    .Enabled = FALSE
    .X = "56"
    .Y = "164"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Button5
    .Text = ""
    .Enabled = FALSE
    .X = "130"
    .Y = "164"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Button6
    .Text = ""
    .Enabled = FALSE
    .X = "204"
    .Y = "164"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Button7
    .Text = ""
    .Enabled = FALSE
    .X = "56"
    .Y = "238"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Button8
    .Text = ""
    .Enabled = FALSE
    .X = "130"
    .Y = "238"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Button9
    .Text = ""
    .Enabled = FALSE
    .X = "204"
    .Y = "238"
    .Height = "60"
    .Width = "60"
  END WITH
  WITH Label1
    .Text = ""
    .Height = "27"
    .Width = "85"
    .X = "205"
    .Y = "40"
  END WITH

END

PUBLIC SUB TextBox1_GotFocus()

  IF TextBox1.Text = "Nombre Jugador 1" THEN
    TextBox1.Clear
  ENDIF
  
END

PUBLIC SUB TextBox2_GotFocus()

  IF TextBox2.Text = "Nombre Jugador 2" THEN
    TextBox2.Clear
  ENDIF

END

PUBLIC SUB TextBox1_LostFocus()

  IF TextBox1.Text = "" THEN
    TextBox1.Text = "Nombre Jugador 1"
  ENDIF

END

PUBLIC SUB TextBox2_LostFocus()

  IF TextBox2.Text = "" THEN
    TextBox2.Text = "Nombre Jugador 2"
  ENDIF

END

PUBLIC SUB Button10_Click()

IF Button10.Text = "Aceptar" THEN
  IF TextBox1.Text = "Nombre Jugador 1" OR TextBox2.Text = "Nombre Jugador 2" THEN
    Message.Error("Para Comenzar el juego debe de escribir el nombre de ambos jugadores", "Aceptar")
  ELSE
    Button1.Enabled = TRUE
    Button2.Enabled = TRUE
    Button3.Enabled = TRUE
    Button4.Enabled = TRUE
    Button5.Enabled = TRUE
    Button6.Enabled = TRUE
    Button7.Enabled = TRUE
    Button8.Enabled = TRUE
    Button9.Enabled = TRUE
    Button10.Text = "Nuevo Juego"
    Message.Info("Inicia " & TextBox1.Text, "Aceptar")
    Label1.Text = TextBox1.Text
  ENDIF
ELSE IF Button10.Text = "Nuevo Juego" THEN
  Button1.Enabled = FALSE
  Button1.Text = ""
  Button2.Enabled = FALSE
  Button2.Text = ""
  Button3.Enabled = FALSE
  Button3.Text = ""
  Button4.Enabled = FALSE
  Button4.Text = ""
  Button5.Enabled = FALSE
  Button5.Text = ""
  Button6.Enabled = FALSE
  Button6.Text = ""
  Button7.Enabled = FALSE
  Button7.Text = ""
  Button8.Enabled = FALSE
  Button8.Text = ""
  Button9.Enabled = FALSE
  Button9.Text = ""
  Button10.Text = "Aceptar"
  Label1.Text = ""
  TextBox1.Text = "Nombre Jugador 1"
  TextBox2.Text = "Nombre Jugador 2"
ENDIF

END

PUBLIC SUB Button1_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button1
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button1.Text = "X" AND Button2.Text = "X" AND Button3.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "X" AND Button4.Text = "X" AND Button7.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "X" AND Button5.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button1
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button1.Text = "O" AND Button2.Text = "O" AND Button3.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "O" AND Button4.Text = "O" AND Button7.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "O" AND Button5.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF
ENDIF

END

PUBLIC SUB Button2_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button2
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button1.Text = "X" AND Button2.Text = "X" AND Button3.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button1.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button2.Text = "X" AND Button5.Text = "X" AND Button8.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button1.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button2
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button1.Text = "O" AND Button2.Text = "O" AND Button3.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button1.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button2.Text = "O" AND Button5.Text = "O" AND Button8.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button1.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF
ENDIF

END

PUBLIC SUB Button3_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button3
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button1.Text = "X" AND Button2.Text = "X" AND Button3.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button1.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "X" AND Button4.Text = "X" AND Button7.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button1.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "X" AND Button5.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button1.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button3
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button1.Text = "O" AND Button2.Text = "O" AND Button3.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button1.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button3.Text = "O" AND Button5.Text = "O" AND Button7.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button1.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button3.Text = "O" AND Button6.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button1.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ENDIF

END

PUBLIC SUB Button4_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button4
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button4.Text = "X" AND Button5.Text = "X" AND Button6.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button1.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "X" AND Button4.Text = "X" AND Button7.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button1.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button4
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button4.Text = "O" AND Button5.Text = "O" AND Button6.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button1.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "O" AND Button4.Text = "O" AND Button7.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button1.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF
ENDIF

END

PUBLIC SUB Button5_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button5
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button4.Text = "X" AND Button5.Text = "X" AND Button6.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button2.Text = "X" AND Button5.Text = "X" AND Button8.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "X" AND Button5.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button7.Text = "X" AND Button5.Text = "X" AND Button3.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button5
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button4.Text = "O" AND Button5.Text = "O" AND Button6.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button2.Text = "O" AND Button5.Text = "O" AND Button8.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "O" AND Button5.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button7.Text = "O" AND Button5.Text = "O" AND Button3.Text = "O" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF
ENDIF
END

PUBLIC SUB Button6_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button6
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button4.Text = "X" AND Button5.Text = "X" AND Button6.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button1.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button3.Text = "X" AND Button6.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button1.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button6
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button4.Text = "O" AND Button5.Text = "O" AND Button6.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button1.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button3.Text = "O" AND Button6.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button1.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF
ENDIF

END

PUBLIC SUB Button7_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button7
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button7.Text = "X" AND Button8.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button5.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "X" AND Button4.Text = "X" AND Button7.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button5.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button3.Text = "X" AND Button5.Text = "X" AND Button7.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button1.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button7
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button7.Text = "O" AND Button8.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button5.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button1.Text = "O" AND Button4.Text = "O" AND Button7.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button5.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button3.Text = "O" AND Button5.Text = "O" AND Button7.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button1.Enabled = FALSE
    Button6.Enabled = FALSE
    Button5.Enabled = FALSE
    Button8.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF
ENDIF

END

PUBLIC SUB Button8_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button8
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button7.Text = "X" AND Button8.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button1.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button2.Text = "X" AND Button5.Text = "X" AND Button8.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button1.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button8
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button7.Text = "O" AND Button8.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button1.Enabled = FALSE
    Button9.Enabled = FALSE
  ELSE IF Button2.Text = "O" AND Button5.Text = "O" AND Button8.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button1.Enabled = FALSE
    Button9.Enabled = FALSE
  ENDIF
ENDIF

END

PUBLIC SUB Button9_Click()

IF Label1.Text = TextBox1.Text THEN
  WITH Button9
    .Text = "X"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox2.Text
  IF Button7.Text = "X" AND Button8.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button1.Enabled = FALSE
  ELSE IF Button3.Text = "X" AND Button6.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button1.Enabled = FALSE
  ELSE IF Button1.Text = "X" AND Button5.Text = "X" AND Button9.Text = "X" THEN
    Message.Info("Gana " & TextBox1.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button1.Enabled = FALSE
  ENDIF  
ELSE IF Label1.Text = TextBox2.Text THEN
  WITH Button9
    .Text = "O"
    .Enabled = FALSE
  END WITH
  Label1.Text = TextBox1.Text
  IF Button7.Text = "O" AND Button8.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button1.Enabled = FALSE
  ELSE IF Button3.Text = "O" AND Button9.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button1.Enabled = FALSE
  ELSE IF Button1.Text = "O" AND Button5.Text = "O" AND Button9.Text = "O" THEN
    Message.Info("Gana " & TextBox2.Text & " Felicitaciones", "Aceptar")
    Button2.Enabled = FALSE
    Button3.Enabled = FALSE
    Button4.Enabled = FALSE
    Button5.Enabled = FALSE
    Button6.Enabled = FALSE
    Button7.Enabled = FALSE
    Button8.Enabled = FALSE
    Button1.Enabled = FALSE
  ENDIF
ENDIF
END
Welcome to your nightmare, bitch.
Responder

Volver a “Otros lenguajes”