Está en la página 1de 19

'******************************************************* '* INSTITUTO TECNOLOGICO SUPERIOR DE INFORMATICA ITSI * '* * *

'* Especialidad: Tecnologa en Informtica '* '* Autor: David Pez Jairo Ushia * '* '* Tercero Vespertino '* * * * * *

'* Objetivo: Simular el juego de Tres en Raya

..

Private Sub borrar() L1.Caption = ""

L2.Caption = "" L3.Caption = "" L4.Caption = "" L5.Caption = "" L6.Caption = "" L7.Caption = "" L8.Caption = "" L9.Caption = "" End Sub Private Sub empate() If L1.Caption <> "" And L2.Caption <> "" And L3.Caption <> "" _ And L4.Caption <> "" And L5.Caption <> "" And L6.Caption <> "" _ And L7.Caption <> "" And L8.Caption <> "" And L9.Caption <> "" Then MsgBox "El juego a terminado empatado", vbOKOnly + vbInformation, _ "Juego terminado" Call borrar End If End Sub

Private Sub L1_Click() If L1.Caption = "" Then If turno.Caption = n1.Caption Then L1.Caption = s1.Caption turno.Caption = n2.Caption Else L1.Caption = s2.Caption

turno.Caption = n1.Caption End If End If If L1.Caption = L2.Caption And L2.Caption = L3.Caption Then If L1.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L1.Caption = L4.Caption And L4.Caption = L7.Caption Then If L1.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L1.Caption = L5.Caption And L5.Caption = L9.Caption Then If L1.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado"

Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If End If Call empate End Sub

Private Sub L2_Click() If L2.Caption = "" Then If turno.Caption = n1.Caption Then L2.Caption = s1.Caption turno.Caption = n2.Caption Else L2.Caption = s2.Caption turno.Caption = n1.Caption End If End If If L1.Caption = L2.Caption And L2.Caption = L3.Caption Then If L1.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1

Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L2.Caption = L5.Caption And L5.Caption = L8.Caption Then If L2.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If End If Call empate End Sub

Private Sub L3_Click() If L3.Caption = "" Then If turno.Caption = n1.Caption Then L3.Caption = s1.Caption turno.Caption = n2.Caption Else L3.Caption = s2.Caption

turno.Caption = n1.Caption End If End If If L1.Caption = L2.Caption And L2.Caption = L3.Caption Then If L1.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L3.Caption = L6.Caption And L6.Caption = L9.Caption Then If L3.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L3.Caption = L5.Caption And L5.Caption = L7.Caption Then If L3.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado"

Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If End If Call empate End Sub

Private Sub L4_Click() If L4.Caption = "" Then If turno.Caption = n1.Caption Then L4.Caption = s1.Caption turno.Caption = n2.Caption Else L4.Caption = s2.Caption turno.Caption = n1.Caption End If End If If L1.Caption = L4.Caption And L4.Caption = L7.Caption Then If L1.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1

Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L4.Caption = L5.Caption And L5.Caption = L6.Caption Then If L4.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If End If Call empate End Sub

Private Sub L5_Click() If L5.Caption = "" Then If turno.Caption = n1.Caption Then L5.Caption = s1.Caption turno.Caption = n2.Caption Else L5.Caption = s2.Caption

turno.Caption = n1.Caption End If End If If L2.Caption = L5.Caption And L5.Caption = L8.Caption Then If L5.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L4.Caption = L5.Caption And L5.Caption = L6.Caption Then If L5.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L1.Caption = L5.Caption And L5.Caption = L9.Caption Then If L5.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado"

Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" L1.Caption = "" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L3.Caption = L5.Caption And L5.Caption = L7.Caption Then If L5.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If End If Call empate End Sub

Private Sub L6_Click() If L6.Caption = "" Then If turno.Caption = n1.Caption Then L6.Caption = s1.Caption

turno.Caption = n2.Caption Else L6.Caption = s2.Caption turno.Caption = n1.Caption End If End If If L4.Caption = L5.Caption And L5.Caption = L6.Caption Then If L6.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L3.Caption = L6.Caption And L6.Caption = L9.Caption Then If L6.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If

End If Call empate End Sub

Private Sub L7_Click() If L7.Caption = "" Then If turno.Caption = n1.Caption Then L7.Caption = s1.Caption turno.Caption = n2.Caption Else L7.Caption = s2.Caption turno.Caption = n1.Caption End If End If If L3.Caption = L5.Caption And L5.Caption = L7.Caption Then If L7.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L1.Caption = L4.Caption And L4.Caption = L7.Caption Then If L7.Caption = s1.Caption Then

MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L7.Caption = L8.Caption And L8.Caption = L9.Caption Then If L7.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If End If Call empate End Sub

Private Sub L8_Click() If L8.Caption = "" Then If turno.Caption = n1.Caption Then L8.Caption = s1.Caption

turno.Caption = n2.Caption Else L8.Caption = s2.Caption turno.Caption = n1.Caption End If End If If L2.Caption = L5.Caption And L5.Caption = L8.Caption Then If L8.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L7.Caption = L8.Caption And L8.Caption = L9.Caption Then If L8.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If

End If Call empate End Sub

Private Sub L9_Click() If L9.Caption = "" Then If turno.Caption = n1.Caption Then L9.Caption = s1.Caption turno.Caption = n2.Caption Else L9.Caption = s2.Caption turno.Caption = n1.Caption End If End If If L3.Caption = L6.Caption And L6.Caption = L9.Caption Then If L9.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L7.Caption = L8.Caption And L8.Caption = L9.Caption Then If L9.Caption = s1.Caption Then

MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If ElseIf L1.Caption = L5.Caption And L5.Caption = L9.Caption Then If L9.Caption = s1.Caption Then MsgBox "El jugo lo a ganado " & n1.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p1.Caption = Val(p1.Caption) + 1 Else MsgBox "El jugo lo a ganado " & n2.Caption, vbInformation + vbOKOnly, "Juego terminado" Call borrar p2.Caption = Val(p2.Caption) + 1 End If End If Call empate End Sub

Private Sub Label6_Click() End End Sub

Private Sub Label7_Click() p1.Caption = "0" p2.Caption = "0" End Sub

Private Sub Label8_Click() ttt.Show Unload Me End Sub

Private Sub p1_Change() If p1.Caption = 10 Then x = MsgBox("juego terminado", vbInformation + vbOKOnly, "El campen es: " _ & n1.Caption) p1.Caption = "0" p2.Caption = "0" End If End Sub

Private Sub p2_Change() If p2.Caption = 10 Then x = MsgBox("juego terminado", vbInformation + vbOKOnly, "El campen es: " _ & n2.Caption) p1.Caption = "0" p2.Caption = "0" End If

End Sub

También podría gustarte