הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 26-01-08, 13:55   # 1
matancp
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: May 2007
מיקום: קרית גת
גיל: 33
הודעות: 83
שלח הודעה באמצעות ICO אל matancp שלח הודעה באמצעות MSN אל matancp

matancp לא מחובר  

אממ יש לי שאלה..

שלום בניתי משחק איקס עיגול ושמתי לב שלפעמים הבוט של המחשב לא קורא את המצבים ולפעמים הוא לא משחק בכלל..
אני יפרסם את הפונקציות של הבוט וגם של השיחוק..
קוד:
    Sub bot()
        If playerlbl.Text = "its O turn" Then
            Dim place As Integer

            Dim found As Boolean = False
            While found = False
                If lbl1_1.Text = "O" And lbl1_2.Text = "O" And lbl1_3.Text = "" Then
                    lbl1_3.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "O" And lbl1_2.Text = "" And lbl1_3.Text = "O" Then
                    lbl1_2.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "" And lbl1_2.Text = "O" And lbl1_3.Text = "O" Then
                    lbl1_1.Text = "O"
                    found = True
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl2_1.Text = "O" And lbl2_2.Text = "O" And lbl2_3.Text = "" Then
                    lbl2_3.Text = "O"
                    found = True
                ElseIf lbl2_1.Text = "O" And lbl2_2.Text = "" And lbl2_3.Text = "O" Then
                    lbl2_2.Text = "O"
                    found = True
                ElseIf lbl2_1.Text = "" And lbl2_2.Text = "O" And lbl2_3.Text = "O" Then
                    lbl2_1.Text = "O"
                    found = True
                    '''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''

                ElseIf lbl3_1.Text = "O" And lbl3_2.Text = "O" And lbl3_3.Text = "" Then
                    lbl3_3.Text = "O"
                    found = True
                ElseIf lbl3_1.Text = "O" And lbl3_2.Text = "" And lbl3_3.Text = "O" Then
                    lbl3_2.Text = "O"
                    found = True
                ElseIf lbl3_1.Text = "" And lbl2_2.Text = "O" And lbl2_3.Text = "O" Then
                    lbl3_1.Text = "O"
                    found = True
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_1.Text = "O" And lbl2_1.Text = "O" And lbl3_1.Text = "" Then
                    lbl3_1.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "O" And lbl2_1.Text = "" And lbl3_1.Text = "O" Then
                    lbl2_1.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "" And lbl2_1.Text = "O" And lbl3_1.Text = "O" Then
                    lbl1_1.Text = "O"
                    found = True
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_2.Text = "O" And lbl2_2.Text = "O" And lbl3_2.Text = "" Then
                    lbl3_2.Text = "O"
                    found = True
                ElseIf lbl1_2.Text = "O" And lbl2_2.Text = "O" And lbl3_2.Text = "" Then
                    lbl3_2.Text = "O"
                    found = True
                ElseIf lbl1_2.Text = "" And lbl2_2.Text = "O" And lbl3_2.Text = "O" Then
                    lbl1_2.Text = "O"
                    found = True
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_3.Text = "O" And lbl2_3.Text = "O" And lbl3_3.Text = "" Then
                    lbl3_3.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "O" And lbl2_3.Text = "" And lbl3_3.Text = "O" Then
                    lbl2_3.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "" And lbl2_3.Text = "O" And lbl3_3.Text = "O" Then
                    lbl1_3.Text = "O"
                    found = True
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_1.Text = "O" And lbl2_2.Text = "O" And lbl3_3.Text = "" Then
                    lbl3_3.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "O" And lbl2_2.Text = "" And lbl3_3.Text = "O" Then
                    lbl2_2.Text = ""
                    found = True
                ElseIf lbl1_1.Text = "" And lbl2_2.Text = "O" And lbl3_3.Text = "O" Then
                    lbl1_1.Text = "O"
                    found = True
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_3.Text = "O" And lbl2_2.Text = "O" And lbl3_1.Text = "" Then
                    lbl3_1.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "O" And lbl2_2.Text = "" And lbl3_1.Text = "O" Then
                    lbl2_2.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "" And lbl2_2.Text = "O" And lbl3_3.Text = "O" Then
                    lbl1_3.Text = "O"
                    found = True
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_1.Text = "X" And lbl1_2.Text = "X" And lbl1_3.Text = "" Then
                    lbl1_3.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "X" And lbl1_2.Text = "" And lbl1_3.Text = "X" Then
                    lbl1_2.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "" And lbl1_2.Text = "X" And lbl1_3.Text = "X" Then
                    lbl1_1.Text = "O"
                    found = True
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl2_1.Text = "X" And lbl2_2.Text = "X" And lbl2_3.Text = "" Then
                    lbl2_3.Text = "O"
                    found = True
                ElseIf lbl2_1.Text = "X" And lbl2_2.Text = "" And lbl2_3.Text = "X" Then
                    lbl2_2.Text = "O"
                    found = True
                ElseIf lbl2_1.Text = "" And lbl2_2.Text = "X" And lbl2_3.Text = "X" Then
                    lbl2_1.Text = "O"
                    found = True
                    '''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''

                ElseIf lbl3_1.Text = "X" And lbl3_2.Text = "X" And lbl3_3.Text = "" Then
                    lbl3_3.Text = "O"
                    found = True
                ElseIf lbl3_1.Text = "X" And lbl3_2.Text = "" And lbl3_3.Text = "X" Then
                    lbl3_2.Text = "O"
                    found = True
                ElseIf lbl3_1.Text = "" And lbl2_2.Text = "X" And lbl2_3.Text = "X" Then
                    lbl3_1.Text = "O"
                    found = True
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_1.Text = "X" And lbl2_1.Text = "X" And lbl3_1.Text = "" Then
                    lbl3_1.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "X" And lbl2_1.Text = "" And lbl3_1.Text = "X" Then
                    lbl2_1.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "" And lbl2_1.Text = "X" And lbl3_1.Text = "X" Then
                    lbl1_1.Text = "O"
                    found = True
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_2.Text = "X" And lbl2_2.Text = "X" And lbl3_2.Text = "" Then
                    lbl3_2.Text = "O"
                    found = True
                ElseIf lbl1_2.Text = "X" And lbl2_2.Text = "X" And lbl3_2.Text = "" Then
                    lbl3_2.Text = "O"
                    found = True
                ElseIf lbl1_2.Text = "" And lbl2_2.Text = "X" And lbl3_2.Text = "X" Then
                    lbl1_2.Text = "O"
                    found = True
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_3.Text = "X" And lbl2_3.Text = "X" And lbl3_3.Text = "" Then
                    lbl3_3.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "X" And lbl2_3.Text = "" And lbl3_3.Text = "X" Then
                    lbl2_3.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "" And lbl2_3.Text = "X" And lbl3_3.Text = "X" Then
                    lbl1_3.Text = "O"
                    found = True
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_1.Text = "X" And lbl2_2.Text = "X" And lbl3_3.Text = "" Then
                    lbl3_3.Text = "O"
                    found = True
                ElseIf lbl1_1.Text = "X" And lbl2_2.Text = "" And lbl3_3.Text = "X" Then
                    lbl2_2.Text = ""
                    found = True
                ElseIf lbl1_1.Text = "" And lbl2_2.Text = "X" And lbl3_3.Text = "X" Then
                    lbl1_1.Text = "O"
                    found = True
                    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl1_3.Text = "X" And lbl2_2.Text = "X" And lbl3_1.Text = "" Then
                    lbl3_1.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "X" And lbl2_2.Text = "" And lbl3_1.Text = "X" Then
                    lbl2_2.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "" And lbl2_2.Text = "X" And lbl3_3.Text = "X" Then
                    lbl1_3.Text = "O"
                    found = True
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                ElseIf lbl3_1.Text = "X" And lbl1_3.Text = "" Then
                    lbl1_3.Text = "O"
                    found = True
                ElseIf lbl1_3.Text = "X" And lbl3_3.Text = "" Then
                    lbl3_3.Text = "O"
                    found = True

                Else

                    place = (Rnd() * 9 + 1)

                    If place = 1 And lbl1_1.Text = "" Then
                        lbl1_1.Text = "O"

                        found = True
                    ElseIf place = 2 And lbl1_2.Text = "" Then
                        lbl1_2.Text = "O"

                        found = True
                    ElseIf place = 3 And lbl1_3.Text = "" Then
                        lbl1_3.Text = "O"

                        found = True
                    ElseIf place = 4 And lbl2_1.Text = "" Then
                        lbl2_1.Text = "O"

                        found = True
                    ElseIf place = 5 And lbl2_2.Text = "" Then
                        lbl2_2.Text = "O"

                        found = True
                    ElseIf place = 6 And lbl2_3.Text = "" Then
                        lbl2_3.Text = "O"

                        found = True
                    ElseIf place = 7 And lbl3_1.Text = "" Then
                        lbl3_1.Text = "O"

                        found = True
                    ElseIf place = 8 And lbl3_2.Text = "" Then
                        lbl3_2.Text = "O"

                        found = True
                    ElseIf place = 9 And lbl3_3.Text = "" Then
                        lbl3_3.Text = "O"

                        found = True
                    End If
                    If lbl1_1.Text <> "" And lbl1_2.Text <> "" And lbl1_3.Text <> "" And lbl2_1.Text <> "" And lbl2_2.Text <> "" And lbl2_3.Text <> "" And lbl3_1.Text <> "" And lbl3_2.Text <> "" And lbl3_3.Text <> "" Then
                        gametimer.Stop()

                        playerlbl.Text = "its X turn"
                        MsgBox("No Winner")
                        restartboard()
                        found = True
                    End If
                End If


            End While
            playerlbl.Text = "its X turn"

        End If


    End Sub
ושל הלחיצה על הlabel
הלוח שלי אגב מסודר לפי
1_1 1_2 1_3 וכו'..
קוד:
    Sub clicked(ByRef lbl As Label)
        If pause = False Then
            If lbl.Text = "" Then
                If playerlbl.Text = "its X turn" Then
                    lbl.Text = "X"
                    playerlbl.Text = "its O turn"
                    prgbar.Value = 0
                Else
                    lbl.Text = "O"
                    playerlbl.Text = "its X turn"
                    prgbar.Value = 0
                End If
                If botX = True Then
                    bot()
                End If
            Else
                MsgBox("Not empty")
            End If
        Else
            MsgBox("You paused the game you need to active the game , Press F3 to active")
        End If

    End Sub
__________________
בתודה,
מתן כהן
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
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 מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 11:59.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ