Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Permenkaret Permenkaret is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 351
Rep Power: 14
Permenkaret mempunyai hidup yang Normal
Default [ask]=visual basic tic-tac-toe game= coding untuk draw/seri/tie

agan2....ada yang tau gak...coding untuk tic-tac-toe kalau permainan gak ada yang menang, alias draw/tie/seri

code yang udah gw bikin untuk menang gini:


Spoiler for code:






Private Sub win()

If Button1.Text = "X" And Button2.Text = "X" And Button3.Text = "X" Then

MsgBox("Player X wins!", MsgBoxStyle.Information)

Label3.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button1.Text = "X" And Button4.Text = "X" And Button7.Text = "X" Then

MsgBox("Player X wins!", MsgBoxStyle.Information)

Label3.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button1.Text = "X" And Button5.Text = "X" And Button9.Text = "X" Then

MsgBox("Player X wins!", MsgBoxStyle.Information)

Label3.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button2.Text = "X" And Button5.Text = "X" And Button8.Text = "X" Then

MsgBox("Player X wins!", MsgBoxStyle.Information)

Label3.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button3.Text = "X" And Button6.Text = "X" And Button9.Text = "X" Then

MsgBox("Player X wins!", MsgBoxStyle.Information)

Label3.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button3.Text = "X" And Button5.Text = "X" And Button7.Text = "X" Then

MsgBox("Player X wins!", MsgBoxStyle.Information)

Label3.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button4.Text = "X" And Button5.Text = "X" And Button6.Text = "X" Then

MsgBox("Player X wins!", MsgBoxStyle.Information)

Label3.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button7.Text = "X" And Button8.Text = "X" And Button9.Text = "X" Then

MsgBox("Player X wins!", MsgBoxStyle.Information)

Label3.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button1.Text = "O" And Button2.Text = "O" And Button3.Text = "O" Then

MsgBox("Player O wins!", MsgBoxStyle.Information)

Label4.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button1.Text = "O" And Button4.Text = "O" And Button7.Text = "O" Then

MsgBox("Player O wins!", MsgBoxStyle.Information)

Label4.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button1.Text = "O" And Button5.Text = "O" And Button9.Text = "O" Then

MsgBox("Player O wins!", MsgBoxStyle.Information)

Label4.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button2.Text = "O" And Button5.Text = "O" And Button8.Text = "O" Then

MsgBox("Player O wins!", MsgBoxStyle.Information)

Label4.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button3.Text = "O" And Button6.Text = "O" And Button9.Text = "O" Then

MsgBox("Player O wins!", MsgBoxStyle.Information)

Label4.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button3.Text = "O" And Button5.Text = "O" And Button7.Text = "O" Then

MsgBox("Player O wins!", MsgBoxStyle.Information)

Label4.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button4.Text = "O" And Button5.Text = "O" And Button6.Text = "O" Then

MsgBox("Player O wins!", MsgBoxStyle.Information)

Label4.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



If Button7.Text = "O" And Button8.Text = "O" And Button9.Text = "O" Then

MsgBox("Player O wins!", MsgBoxStyle.Information)

Label4.Text += 1

Button1.Text = ""

Button2.Text = ""

Button3.Text = ""

Button4.Text = ""

Button5.Text = ""

Button6.Text = ""

Button7.Text = ""

Button8.Text = ""

Button9.Text = ""

End If



End Sub











Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 01:08 AM.


no new posts