9Mcode comment |
|
|
|
|
|
|
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
|
|
|
กระทู้ #1994 [.NET] (จาก IP: 202.149.24.129)
ขอโค้ดเกม OX
อยากได้โค้ดเกม OX แบบเล่นกับคอมค่ะใช้ VB . NET ค่ะใครพอมีบ้างช่วยบอกหน่อยนะค่ะต้องทำเป็นโปรเจ็คส่งอาจารย์ค่ะ
|
จากคุณ
:
nan / dongpron_kai@hotmail.com [2008-05-03 03:59:31]
|
|
ความคิดเห็น #26721 (จาก IP: 58.8.251.160)
Dim b1, b2, b3, b4, b5, b6, b7, b8, b9 As Integer Dim result As String
Sub checkO() If Command1.Caption = "O" And Command2.Caption = "O" And Command3.Caption = "O" Then Label1.Caption = "ผู้เล่นที่ 2 ชนะ" Option1.Enabled = False Command4.Enabled = False Command5.Enabled = False Command6.Enabled = False Command7.Enabled = False Command8.Enabled = False Command9.Enabled = False ElseIf Command4.Caption = "O" And Command5.Caption = "O" And Command6.Caption = "O" Then Label1.Caption = "ผู้เล่นที่ 2 ชนะ" Option1.Enabled = False Command1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command7.Enabled = False Command8.Enabled = False Command9.Enabled = False ElseIf Command7.Caption = "O" And Command8.Caption = "O" And Command9.Caption = "O" Then Label1.Caption = "ผู้เล่นที่ 2 ชนะ" Option1.Enabled = False Command1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command4.Enabled = False Command5.Enabled = False Command6.Enabled = False ElseIf Command1.Caption = "O" And Command4.Caption = "O" And Command7.Caption = "O" Then Label1.Caption = "ผู้เล่นที่ 2 ชนะ" Option1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command5.Enabled = False Command6.Enabled = False Command8.Enabled = False Command9.Enabled = False ElseIf Command2.Caption = "O" And Command5.Caption = "O" And Command8.Caption = "O" Then Label1.Caption = "ผู้เล่นที่ 2 ชนะ" Option1.Enabled = False Command1.Enabled = False Command3.Enabled = False Command4.Enabled = False Command6.Enabled = False Command7.Enabled = False Command9.Enabled = False ElseIf Command3.Caption = "O" And Command6.Caption = "O" And Command9.Caption = "O" Then Label1.Caption = "ผู้เล่นที่ 2 ชนะ" Option1.Enabled = False Command1.Enabled = False Command2.Enabled = False Command4.Enabled = False Command5.Enabled = False Command7.Enabled = False Command8.Enabled = False ElseIf Command1.Caption = "O" And Command5.Caption = "O" And Command9.Caption = "O" Then Label1.Caption = "ผู้เล่นที่ 2 ชนะ" Option1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command4.Enabled = False Command6.Enabled = False Command7.Enabled = False Command8.Enabled = False ElseIf Command3.Caption = "O" And Command5.Caption = "O" And Command7.Caption = "O" Then Label1.Caption = "ผู้เล่นที่ 2 ชนะ" Option1.Enabled = False Command1.Enabled = False Command2.Enabled = False Command4.Enabled = False Command6.Enabled = False Command8.Enabled = False Command9.Enabled = False End If End Sub
Sub checkX() If Command1.Caption = "X" And Command2.Caption = "X" And Command3.Caption = "X" Then Label1.Caption = "ผู้เล่นที่ 1 ชนะ" Option2.Enabled = False Command4.Enabled = False Command5.Enabled = False Command6.Enabled = False Command7.Enabled = False Command8.Enabled = False Command9.Enabled = False ElseIf Command4.Caption = "X" And Command5.Caption = "X" And Command6.Caption = "X" Then Label1.Caption = "ผู้เล่นที่ 1 ชนะ" Option2.Enabled = False Command1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command7.Enabled = False Command8.Enabled = False Command9.Enabled = False ElseIf Command7.Caption = "X" And Command8.Caption = "X" And Command9.Caption = "X" Then Label1.Caption = "ผู้เล่นที่ 1 ชนะ" Option2.Enabled = False Command1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command4.Enabled = False Command5.Enabled = False Command6.Enabled = False ElseIf Command1.Caption = "X" And Command4.Caption = "X" And Command7.Caption = "X" Then Label1.Caption = "ผู้เล่นที่ 1 ชนะ" Option2.Enabled = False Command2.Enabled = False Command3.Enabled = False Command5.Enabled = False Command6.Enabled = False Command8.Enabled = False Command9.Enabled = False ElseIf Command2.Caption = "X" And Command5.Caption = "X" And Command8.Caption = "X" Then Label1.Caption = "ผู้เล่นที่ 1 ชนะ" Option2.Enabled = False Command1.Enabled = False Command3.Enabled = False Command4.Enabled = False Command6.Enabled = False Command7.Enabled = False Command9.Enabled = False ElseIf Command3.Caption = "X" And Command6.Caption = "X" And Command9.Caption = "X" Then Label1.Caption = "ผู้เล่นที่ 1 ชนะ" Option2.Enabled = False Command1.Enabled = False Command2.Enabled = False Command4.Enabled = False Command5.Enabled = False Command7.Enabled = False Command8.Enabled = False ElseIf Command1.Caption = "X" And Command5.Caption = "X" And Command9.Caption = "X" Then Label1.Caption = "ผู้เล่นที่ 1 ชนะ" Option2.Enabled = False Command2.Enabled = False Command3.Enabled = False Command4.Enabled = False Command6.Enabled = False Command7.Enabled = False Command8.Enabled = False ElseIf Command3.Caption = "X" And Command5.Caption = "X" And Command7.Caption = "X" Then Label1.Caption = "ผู้เล่นที่ 1 ชนะ" Option2.Enabled = False Command1.Enabled = False Command2.Enabled = False Command4.Enabled = False Command6.Enabled = False Command8.Enabled = False Command9.Enabled = False End If End Sub
Sub checkdraw() If Command1.Caption <> "" And Command2.Caption <> "" And Command3.Caption <> "" And Command4.Caption <> "" And Command5.Caption <> "" And Command6.Caption <> "" And Command7.Caption <> "" And Command8.Caption <> "" And Command9.Caption <> "" And Label1.Caption = "" Then Label1.Caption = "เสมอกัน" Command1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command4.Enabled = False Command5.Enabled = False Command6.Enabled = False Command7.Enabled = False Command8.Enabled = False Command9.Enabled = False result = Label1.Caption End If End Sub
Private Sub Command1_Click() If b1 = 0 Then If Option1 = True Then Command1.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command1.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b1 = b1 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Command2_Click() If b2 = 0 Then If Option1 = True Then Command2.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command2.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b2 = b2 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Command3_Click() If b3 = 0 Then If Option1 = True Then Command3.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command3.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b3 = b3 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Command4_Click() If b4 = 0 Then If Option1 = True Then Command4.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command4.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b4 = b4 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Command5_Click() If b5 = 0 Then If Option1 = True Then Command5.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command5.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b5 = b5 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Command6_Click() If b6 = 0 Then If Option1 = True Then Command6.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command6.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b6 = b6 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Command7_Click() If b7 = 0 Then If Option1 = True Then Command7.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command7.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b7 = b7 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Command8_Click() If b8 = 0 Then If Option1 = True Then Command8.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command8.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b8 = b8 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Command9_Click() If b9 = 0 Then If Option1 = True Then Command9.Caption = "X" Option2 = True Option1.Enabled = False Option2.Enabled = True Else Command9.Caption = "O" Option1 = True Option2.Enabled = False Option1.Enabled = True End If checkO checkX checkdraw b9 = b9 + 1 result = Label1.Caption Else MsgBox "ช่องนี้ได้มีการกาไปเรียบร้อยแล้วครับ", vbCritical, "ผิดพลาด" End If End Sub
Private Sub Form_Load() Option1 = True Option2.Enabled = False
End Sub
Private Sub mmabout_Click(Index As Integer) MsgBox "เกม XO เวอร์ชั่น 1.0 โดย ด.ช.ศิลป์ สัจจะวัฒนวิมล", vbInformation, "เกี่ยวกับ" End Sub
Private Sub mmexit_Click(Index As Integer) Dim answer As Integer answer = MsgBox("คุณแน่ใจหรือว่าต้องการจะออกจากโปรแกรม ?", vbQuestion + vbOKCancel, "ออกจากโปรแกรม") If answer = 1 Then End End If End Sub
Private Sub mmlastscore_Click(Index As Integer) If result <> "" Then MsgBox "ในรอบที่ผ่านมา" + " " + result + " " + "ครับ", vbInformation, "ผลในรอบที่ผ่านมา" Else MsgBox "ยังไม่มีการเริ่มเล่นเกมครับ", vbInformation, "ผลในรอบที่ผ่านมา" End If End Sub
Private Sub mmnew_Click(Index As Integer) Command1.Caption = "" Command2.Caption = "" Command3.Caption = "" Command4.Caption = "" Command5.Caption = "" Command6.Caption = "" Command7.Caption = "" Command8.Caption = "" Command9.Caption = "" Label1.Caption = "" Option1.Enabled = True Option2.Enabled = False Option1 = True b1 = 0 b2 = 0 b3 = 0 b4 = 0 b5 = 0 b6 = 0 b7 = 0 b8 = 0 b9 = 0 Command1.Enabled = True Command2.Enabled = True Command3.Enabled = True Command4.Enabled = True Command5.Enabled = True Command6.Enabled = True Command7.Enabled = True Command8.Enabled = True Command9.Enabled = True End Sub |
จากคุณ
:
sup98 [2008-05-03 10:26:21]
|
|
ความคิดเห็น #27663 (จาก IP: 202.176.107.90)
อยากได้โค้ด XO ที่เป็น C อ่าค่ะ |
จากคุณ
:
jazziii / poohza@windowslive.com [2009-12-18 02:13:38]
|
|
|
- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -
|
|
|
|
|
|
|