• Revista PROGRAMAR: Já está disponível a edição #53 da revista programar. Faz já o download aqui!

Arquivado

Este tópico foi arquivado, e está fechado a novas respostas.

Shadows_DML

[Open Source] [VB] Jogo do Galo

13 mensagens neste tópico

Titulo do Projecto: Jogo do Galo

Última Versão: 1.0

Líder do Projecto: ShadowsDML

Membros Actuais do Projecto:

    * ShadowsDML

Descrição do Projecto:

Ando a aprender VB na escola entao para consolidar conhecimentos e practicar fiz este jogo:

Testem aí e ponham os bugs que encontrarem quando tiver corrigido ponho o código. :)

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Sei que o código é muito grande e que tem coisas desnecessárias mas ainda só tenho 2 meses de VB :biggrin:

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label2.Text = "1"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Label2.Text = "1" Then
            Button1.Text = "X"
        ElseIf Label2.Text = "2" Then
            Button1.Text = "O"
        End If
        Button1.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If




        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        If Label2.Text = "1" Then
            Button2.Text = "X"
        Else
            Button2.Text = "O"
        End If
        Button2.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If Label2.Text = "1" Then
            Button3.Text = "X"
        Else
            Button3.Text = "O"
        End If
        Button3.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If Label2.Text = "1" Then
            Button4.Text = "X"
        Else
            Button4.Text = "O"
        End If
        Button4.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

        If Label2.Text = "1" Then
            Button5.Text = "X"
        Else
            Button5.Text = "O"
        End If
        Button5.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

        If Label2.Text = "1" Then
            Button6.Text = "X"
        Else
            Button6.Text = "O"
        End If
        Button6.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        If Label2.Text = "1" Then
            Button7.Text = "X"
        Else
            Button7.Text = "O"
        End If
        Button7.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click


        If Label2.Text = "1" Then
            Button8.Text = "X"
        Else
            Button8.Text = "O"
        End If
        Button8.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click


        If Label2.Text = "1" Then
            Button9.Text = "X"
        Else
            Button9.Text = "O"
        End If
        Button9.Enabled = False

        If Label2.Text = "1" Then
            Label2.Text = "2"
        Else
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
        End If

        If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Or Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Or Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If


        If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "1"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If

        If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then
            Label1.Text = "Ganhou!"
            Label2.Text = "2"
            Button1.Enabled = False
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Enabled = False
            Button5.Enabled = False
            Button6.Enabled = False
            Button7.Enabled = False
            Button8.Enabled = False
            Button9.Enabled = False
        End If
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Button1.Text = ""
        Button2.Text = ""
        Button3.Text = ""
        Button4.Text = ""
        Button5.Text = ""
        Button6.Text = ""
        Button7.Text = ""
        Button8.Text = ""
        Button9.Text = ""

        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

        Label2.Text = "1"
        Label1.Text = "Jogador"
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        End
    End Sub
End Class

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Então e se o jogo do galo fosse 9x9 em vez de 3x3? Ias escrever as soluções todas? :)

Tens que fazer uma matriz que vais alterando quando se jogo e vais vendo se tens na vertical, na horizontal ou na diagonal alguma "combinação vencedora". :P

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Como usas botões para fazer o "campo", podias usar um array de buttons, penso que ficaria mais simples e dava para trabalhar melhor.

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

WOW!

That's a LOT (e deixa-me frisar A LOT!!) of code!!

Mas gabo-te a paciência.

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

mesmo. não percebo muito de vb mas pelo tamanho do código.... isso e que e empenho. concordo com oTheDark

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

o meu primeiro jogo do galo era deste genero...fiz as possibilidades todas. Na altura era a unica maneira que sabia fazer, dai nem ter postado o codigo ^^

mas eu no meu fiz 1x1, 1xPC(easy), 1xPC(normal), 1xPC(hard), 1xPC(very hard)...agora imaginem o tamanho do código. ;)

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites