Jump to content
Raven

X and Zer0 Source code

Recommended Posts

Public Class Form1
Dim tic As Integer



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tic = 1
End Sub
Private Sub win()
If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Then
MsgBox("Jucatorul X a castigat!!!!!", MsgBoxStyle.OkCancel)
Label6.Text += 1
Button10.Enabled = True
ElseIf Button4.Text = "X" And Button5.Text = "X" And Button6.Text = "X" Then
MsgBox("Jucatorul X a castigat!!!!!", MsgBoxStyle.OkCancel)
Label6.Text += 1
Button10.Enabled = True
ElseIf Button7.Text = "X" And Button8.Text = "X" And Button9.Text = "X" Then
MsgBox("Jucatorul X a castigat!!!!!", MsgBoxStyle.OkCancel)
Label6.Text += 1
Button10.Enabled = True
ElseIf Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then
MsgBox("Jucatorul X a castigat!!!!!", MsgBoxStyle.OkCancel)
Label6.Text += 1
Button10.Enabled = True
ElseIf Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then
MsgBox("Jucatorul X a castigat!!!!!", MsgBoxStyle.OkCancel)
Label6.Text += 1
Button10.Enabled = True
ElseIf Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then
MsgBox("Jucatorul X a castigat!!!!!", MsgBoxStyle.OkCancel)
Label6.Text += 1
Button10.Enabled = True
ElseIf Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then
MsgBox("Jucatorul X a castigat!!!!!", MsgBoxStyle.OkCancel)
Label6.Text += 1
Button10.Enabled = True
ElseIf Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then
MsgBox("Jucatorul X a castigat!!!!!", MsgBoxStyle.OkCancel)
Label6.Text += 1
Button10.Enabled = True
End If
' ok acu cu 0

If Button1.Text = "0" And Button2.Text = "0" And Button3.Text = "0" Then
MsgBox("Jucatorul 0 a castigat!!!!!", MsgBoxStyle.OkCancel)
Label7.Text += 1
Button10.Enabled = True
ElseIf Button4.Text = "0" And Button5.Text = "0" And Button6.Text = "0" Then
MsgBox("Jucatorul 0 a castigat!!!!!", MsgBoxStyle.OkCancel)
Label7.Text += 1
Button10.Enabled = True
ElseIf Button7.Text = "0" And Button8.Text = "0" And Button9.Text = "0" Then
MsgBox("Jucatorul 0 a castigat!!!!!", MsgBoxStyle.OkCancel)
Label7.Text += 1
Button10.Enabled = True
ElseIf Button1.Text = "0" And Button4.Text = "0" And Button7.Text = "0" Then
MsgBox("Jucatorul 0 a castigat!!!!!", MsgBoxStyle.OkCancel)
Label7.Text += 1
Button10.Enabled = True
ElseIf Button2.Text = "0" And Button5.Text = "0" And Button8.Text = "0" Then
MsgBox("Jucatorul 0 a castigat!!!!!", MsgBoxStyle.OkCancel)
Label7.Text += 1
Button10.Enabled = True
ElseIf Button3.Text = "0" And Button6.Text = "0" And Button9.Text = "0" Then
MsgBox("Jucatorul 0 a castigat!!!!!", MsgBoxStyle.OkCancel)
Label7.Text += 1
Button10.Enabled = True
ElseIf Button1.Text = "0" And Button5.Text = "0" And Button9.Text = "0" Then
MsgBox("Jucatorul 0 a castigat!!!!!", MsgBoxStyle.OkCancel)
Label7.Text += 1
ElseIf Button3.Text = "0" And Button5.Text = "0" And Button7.Text = "0" Then
MsgBox("Jucatorul 0 a castigat!!!!!", MsgBoxStyle.OkCancel)
Label7.Text += 1
ElseIf Button1.Text = "X" And Button2.Text = "0" And Button3.Text = "X" Then
MsgBox("Remiza")
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If tic = 1 Then
Button1.Text = "0"
Label2.Text = "X"

Else
Button1.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If tic = 1 Then
Button2.Text = "0"
Label2.Text = "X"
Else
Button2.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If tic = 1 Then
Button3.Text = "0"
Label2.Text = "X"
Else
Button3.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If tic = 1 Then
Button4.Text = "0"
Label2.Text = "X"
Else
Button4.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If tic = 1 Then
Button5.Text = "0"
Label2.Text = "X"
Else
Button5.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If tic = 1 Then
Button6.Text = "0"
Label2.Text = "X"
Else
Button6.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If tic = 1 Then
Button7.Text = "0"
Label2.Text = "X"
Else
Button7.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If tic = 1 Then
Button8.Text = "0"
Label2.Text = "X"
Else
Button8.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If tic = 1 Then
Button9.Text = "0"
Label2.Text = "X"
Else
Button9.Text = "X"
Label2.Text = "0"
End If
tic += 1
If tic > 2 Then
tic = 1
End If
Call win()
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 = ""
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
MsgBox("Joc creat de Raven")
Form2.Show()
End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Label6.Text = "0"
Label7.Text = "0"
End Sub


End Class

Autor : Eu

Download Source code:

http://rapidshare.com/files/182075755/X_and_Zer0.rar.html

Link to comment
Share on other sites

Functia win() e criminala. Daca faceai X si 0 pe o tabla de dimensiunea 10 nu cred ca o terminai. Nu era mai simplu sa salvezi clickurile intr-o matrice? Cu doua while-uri si un if faceai tot ce ai scris tu acolo.

tic += 1

If tic > 2 Then

tic = 1

If-ul ala e aiurea.

Fie pui

j=!j

fie

j^=1

Si, daca tot e sa faci ceva, fa-l ca userul sa aibe posibilitatea sa joace cu PC-ul.

http://en.wikipedia.org/wiki/Minimax

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...