[GAME] TicTacToe (3 Gewinnt)

  • Hallo leutz ... bin heute wieder aus dem Urlaub zurück und habe dort ein kleines Spiel geschrieben...Ich konnt nicht schlafen und dann kam mir der Einfall TicTacToe zu schreiben...Nun ja dass habe ich auch getan und hier ist das Ergebnis.

    Ihr könnt gegen einen Freund spielen oder auch gegen den Computer...Ist jetzt war nicht das schwerste zum programmieren aber ihr könnt ja trotzdem mal eure Kritik äußern...

    Spoiler anzeigen
    [autoit]

    #cs

    [/autoit] [autoit][/autoit] [autoit]

    Autor: Marcel Böhm (Reaker)
    Copyright 2010 by Marcel
    Email: [email='boehm.marcel@gmail.com'][/email]

    [/autoit] [autoit][/autoit] [autoit]

    #ce

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <GuiButton.au3>
    #include <Array.au3>
    #include <GuiStatusBar.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $Feld[10], $FeldSt[10]
    Global $Turn
    Global $GamePlay
    Global $Gewonnen = 0
    Global Const $GUI_Title = "TicTacToe by Reaker"
    Global Const $Version = "1.0"

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $GUI_BK = 0x307A8F
    Global Const $SIGN_CO = 0xFF0000
    Global Const $GUI_TRANS = 225
    Global Const $Path_Ini = @ScriptDir & "\config.ini"

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If Not FileExists($Path_Ini) Then
    IniWrite($Path_Ini, "Settings", "GamePlay", "1")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If IniRead($Path_Ini, "Settings", "GamePlay", "") = "1" Then
    $GamePlay = 1
    Else
    $GamePlay = 2
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=C:\Users\Marcel\Sonstiges\Skripte\Autoit3\Projekte\TicTacToe\Form1.kxf
    Global $Form1 = GUICreate($GUI_Title, 425, 463, -1, -1)
    GUISetCursor(3)
    WinSetTrans($Form1, Default, $GUI_TRANS)
    GUISetBkColor($GUI_BK)
    Global $Button1 = GUICtrlCreateButton("Neues Spiel", 20, 405, 96, 26, $WS_GROUP)
    Global $Button2 = GUICtrlCreateButton("Optionen", 125, 405, 91, 26, $WS_GROUP)
    Global $Button3 = GUICtrlCreateButton("About", 230, 405, 91, 26, $WS_GROUP)
    $Feld[1] = GUICtrlCreateButton("", 20, 15, 121, 121, $WS_GROUP)
    $Feld[2] = GUICtrlCreateButton("", 152, 14, 121, 121, $WS_GROUP)
    $Feld[3] = GUICtrlCreateButton("", 285, 14, 121, 121, $WS_GROUP)
    $Feld[4] = GUICtrlCreateButton("", 20, 143, 121, 121, $WS_GROUP)
    $Feld[5] = GUICtrlCreateButton("", 152, 143, 121, 121, $WS_GROUP)
    $Feld[6] = GUICtrlCreateButton("", 285, 143, 121, 121, $WS_GROUP)
    $Feld[7] = GUICtrlCreateButton("", 20, 273, 121, 121, $WS_GROUP)
    $Feld[8] = GUICtrlCreateButton("", 152, 273, 121, 121, $WS_GROUP)
    $Feld[9] = GUICtrlCreateButton("", 285, 273, 121, 121, $WS_GROUP)
    For $i = 1 To 9
    GUICtrlSetFont($Feld[$i], 100, 800, 0, "MS Sans Serif")
    Next
    Global $StatusBar1 = _GUICtrlStatusBar_Create($Form1)
    Global $StatusBar1_PartsWidth[2] = [110, -1]
    _GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
    _GUICtrlStatusBar_SetMinHeight($StatusBar1, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    AdlibRegister("_DrawLine", 100)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=C:\Users\Marcel\Sonstiges\Skripte\Autoit3\Projekte\TicTacToe\Form2.kxf
    Global $Form2 = GUICreate("Optionen", 236, 158, 285, 182, Default, Default, $Form1)
    GUISetBkColor($GUI_BK)
    WinSetTrans($Form2, Default, $GUI_TRANS + 20)
    Global $Radio1 = GUICtrlCreateRadio("Gegen Computer (1 Spieler)", 20, 20, 156, 16)
    GUICtrlSetState(-1, $GUI_CHECKED)
    Global $Radio2 = GUICtrlCreateRadio("Gegen Person (2 Spieler)", 20, 40, 161, 21)
    Global $Button5 = GUICtrlCreateButton("Speichern", 140, 130, 86, 23, $WS_GROUP)
    Global $Button4 = GUICtrlCreateButton("Abbrechen", 50, 130, 86, 23, $WS_GROUP)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _NewGame()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg(1)
    Switch $nMsg[1]
    Case $Form1
    Switch $nMsg[0]
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _NewGame()
    Case $Button2
    GUISetState(@SW_SHOW, $Form2)
    WinSetState($Form1, Default, @SW_DISABLE)
    Case $Button3
    MsgBox(0, "About", _
    "TicTacToe - Game" & @LF & _
    "" & @LF & _
    "Autor: Marcel Böhm (Reaker) " & @LF & _
    "Email: [email='boehm.marcel@gmail.com'][/email] " & @LF & _
    "Version: " & $Version & " (20.02.2010)" & @LF & _
    "Copyright by Marcel Böhm 2010")
    Case $Feld[1]
    _click(1)
    Case $Feld[2]
    _click(2)
    Case $Feld[3]
    _click(3)
    Case $Feld[4]
    _click(4)
    Case $Feld[5]
    _click(5)
    Case $Feld[6]
    _click(6)
    Case $Feld[7]
    _click(7)
    Case $Feld[8]
    _click(8)
    Case $Feld[9]
    _click(9)
    EndSwitch
    Case $Form2
    Switch $nMsg[0]
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE, $Form2)
    WinSetState($Form1, Default, @SW_ENABLE)
    Case $Button4
    GUISetState(@SW_HIDE, $Form2)
    WinSetState($Form1, Default, @SW_ENABLE)
    Case $Button5
    If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then
    IniWrite($Path_Ini, "Settings", "GamePlay", "1")
    Else
    IniWrite($Path_Ini, "Settings", "GamePlay", "2")
    EndIf
    TrayTip("Info", "Erfolgreich gespeichert", 1, 1)
    GUISetState(@SW_HIDE, $Form2)
    WinSetState($Form1, Default, @SW_ENABLE)
    EndSwitch
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _click($flag)
    $Gewonnen = 0
    If $GamePlay = 1 Then
    Switch $FeldSt[$flag]
    Case 1 ;freies Feld
    GUICtrlSetData($Feld[$flag], "X")
    $FeldSt[$flag] = 2
    If _Gewonnen() = 0 Then
    ;computer zug
    If $Gewonnen = 0 Then
    _ComZug()

    [/autoit] [autoit][/autoit] [autoit]

    _Gewonnen()

    [/autoit] [autoit][/autoit] [autoit]

    EndIf
    EndIf
    Case 2
    TrayTip("Info", "Auf diesem Feld ist bereits ein Kreuz", 1, 3)
    Case 3
    TrayTip("Info", "Auf diesem Feld ist bereits ein Kreis", 1, 3)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    Else
    Switch $FeldSt[$flag]
    Case 1 ;freies Feld
    If $Turn = 1 Then
    GUICtrlSetData($Feld[$flag], "X")
    $FeldSt[$flag] = 2
    Else
    GUICtrlSetData($Feld[$flag], "O")
    $FeldSt[$flag] = 3
    EndIf
    If $Turn = 1 Then
    $Turn = 2
    Else
    $Turn = 1
    EndIf
    Case 2 ;markiert - Kreuz
    TrayTip("Info", "Auf diesem Feld ist bereits ein Kreuz", 1, 3)
    Case 3 ;markiert - Kreis
    TrayTip("Info", "Auf diesem Feld ist bereits ein Kreis", 1, 3)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    _Gewonnen()

    [/autoit] [autoit][/autoit] [autoit]

    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>_click

    [/autoit] [autoit][/autoit] [autoit]

    Func _Gewonnen()
    If $FeldSt[1] <> 1 And $FeldSt[2] <> 1 And $FeldSt[3] <> 1 And $FeldSt[4] <> 1 And $FeldSt[5] <> 1 And $FeldSt[6] <> 1 And $FeldSt[7] <> 1 And $FeldSt[8] <> 1 And $FeldSt[9] <> 1 Then
    $Gewonnen = 3
    EndIf
    ;##Kreuz gewonnen##
    If $FeldSt[1] = 2 And $FeldSt[2] = 2 And $FeldSt[3] = 2 Then
    $Gewonnen = 2
    EndIf
    If $FeldSt[4] = 2 And $FeldSt[5] = 2 And $FeldSt[6] = 2 Then
    $Gewonnen = 2
    EndIf
    If $FeldSt[7] = 2 And $FeldSt[8] = 2 And $FeldSt[9] = 2 Then
    $Gewonnen = 2
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 2 And $FeldSt[4] = 2 And $FeldSt[7] = 2 Then
    $Gewonnen = 2
    EndIf
    If $FeldSt[2] = 2 And $FeldSt[5] = 2 And $FeldSt[8] = 2 Then
    $Gewonnen = 2
    EndIf
    If $FeldSt[3] = 2 And $FeldSt[6] = 2 And $FeldSt[9] = 2 Then
    $Gewonnen = 2
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 2 And $FeldSt[5] = 2 And $FeldSt[9] = 2 Then
    $Gewonnen = 2
    EndIf
    If $FeldSt[3] = 2 And $FeldSt[5] = 2 And $FeldSt[7] = 2 Then
    $Gewonnen = 2
    EndIf
    ;##Kreis gewonnen##
    If $FeldSt[1] = 3 And $FeldSt[2] = 3 And $FeldSt[3] = 3 Then
    $Gewonnen = 1
    EndIf
    If $FeldSt[4] = 3 And $FeldSt[5] = 3 And $FeldSt[6] = 3 Then
    $Gewonnen = 1
    EndIf
    If $FeldSt[7] = 3 And $FeldSt[8] = 3 And $FeldSt[9] = 3 Then
    $Gewonnen = 1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 3 And $FeldSt[4] = 3 And $FeldSt[7] = 3 Then
    $Gewonnen = 1
    EndIf
    If $FeldSt[2] = 3 And $FeldSt[5] = 3 And $FeldSt[8] = 3 Then
    $Gewonnen = 1
    EndIf
    If $FeldSt[3] = 3 And $FeldSt[6] = 3 And $FeldSt[9] = 3 Then
    $Gewonnen = 1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 3 And $FeldSt[5] = 3 And $FeldSt[9] = 3 Then
    $Gewonnen = 1
    EndIf
    If $FeldSt[3] = 3 And $FeldSt[5] = 3 And $FeldSt[7] = 3 Then
    $Gewonnen = 1
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If $Gewonnen = 1 Then
    _GUICtrlStatusBar_SetText($StatusBar1, "Kreis hat gewonnen", 1)
    MsgBox(0, "Gewonnen!!!", "Kreis hat gewonnen")
    ElseIf $Gewonnen = 2 Then
    _GUICtrlStatusBar_SetText($StatusBar1, "Kreuz hat gewonnen", 1)
    MsgBox(0, "Gewonnen!!!", "Kreuz hat gewonnen")
    ElseIf $Gewonnen = 0 Then

    [/autoit] [autoit][/autoit] [autoit]

    If $Turn = 1 Then
    _GUICtrlStatusBar_SetText($StatusBar1, "Kreuz ist dran", 1)
    Else
    _GUICtrlStatusBar_SetText($StatusBar1, "Kreis ist dran", 1)
    EndIf
    Return 0
    EndIf
    If $Gewonnen <> 0 Then
    If $Gewonnen = 3 Then
    $msg = MsgBox(4, "Unentschieden!!!", "Soll ein neues Spiel gestartet werden?")
    If $msg = 6 Then
    _NewGame()
    Else
    Exit
    EndIf
    Else
    $msg = MsgBox(4, "Neues Spiel?", "Soll ein neues Spiel gestartet werden?")
    If $msg = 6 Then
    _NewGame()
    Else
    Exit
    EndIf
    EndIf
    EndIf
    EndFunc ;==>_Gewonnen

    [/autoit] [autoit][/autoit] [autoit]

    Func _NewGame()
    For $i = 1 To 9
    $FeldSt[$i] = 1
    GUICtrlSetData($Feld[$i], "")
    Next
    If IniRead($Path_Ini, "Settings", "GamePlay", "") = "1" Then
    $GamePlay = 1
    Else
    $GamePlay = 2
    EndIf
    If $GamePlay = 1 Then
    _GUICtrlStatusBar_SetText($StatusBar1, "Gegen Computer", 0)
    Else
    _GUICtrlStatusBar_SetText($StatusBar1, "Gegen Person", 0)
    EndIf
    $Turn = 1 ;Kreuz
    If $Turn = 1 Then
    _GUICtrlStatusBar_SetText($StatusBar1, "Kreuz ist dran", 1)
    Else
    _GUICtrlStatusBar_SetText($StatusBar1, "Kreis ist dran", 1)
    EndIf
    EndFunc ;==>_NewGame

    [/autoit] [autoit][/autoit] [autoit]

    Func _DrawLine()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Form1)
    $hPen = _GDIPlus_PenCreate(0xFF000000, 6)
    _GDIPlus_GraphicsDrawLine($hGraphic, 146, 14, 146, 397, $hPen)
    _GDIPlus_GraphicsDrawLine($hGraphic, 278, 14, 278, 397, $hPen)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawLine($hGraphic, 18, 139, 405, 139, $hPen)
    _GDIPlus_GraphicsDrawLine($hGraphic, 18, 268, 405, 268, $hPen)
    EndFunc ;==>_DrawLine

    [/autoit] [autoit][/autoit] [autoit]

    Func _ComZug()
    Local $FeldRem[1], $Random = ""

    [/autoit] [autoit][/autoit] [autoit]

    ;###################### Bei welchen Möglichkeiten man Gewinnen kann (Liste nicht vollständig, damit man noch etwas Chance hat) #############
    ;wenn 2 Kreuze
    If $FeldSt[1] = 2 And $FeldSt[3] = 2 And $FeldSt[2] = 1 Then _ArrayAdd($FeldRem, 2)
    If $FeldSt[4] = 2 And $FeldSt[6] = 2 And $FeldSt[5] = 1 Then _ArrayAdd($FeldRem, 5)
    If $FeldSt[7] = 2 And $FeldSt[9] = 2 And $FeldSt[8] = 1 Then _ArrayAdd($FeldRem, 8)

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 2 And $FeldSt[7] = 2 And $FeldSt[4] = 1 Then _ArrayAdd($FeldRem, 4)
    If $FeldSt[2] = 2 And $FeldSt[8] = 2 And $FeldSt[5] = 1 Then _ArrayAdd($FeldRem, 5)
    If $FeldSt[3] = 2 And $FeldSt[9] = 2 And $FeldSt[6] = 1 Then _ArrayAdd($FeldRem, 6)

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 2 And $FeldSt[9] = 2 And $FeldSt[5] = 1 Then _ArrayAdd($FeldRem, 5)
    If $FeldSt[3] = 2 And $FeldSt[7] = 2 And $FeldSt[5] = 1 Then _ArrayAdd($FeldRem, 5)

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 2 And $FeldSt[5] = 2 And $FeldSt[9] = 1 Then _ArrayAdd($FeldRem, 9)
    If $FeldSt[3] = 2 And $FeldSt[5] = 2 And $FeldSt[7] = 1 Then _ArrayAdd($FeldRem, 7)
    If $FeldSt[9] = 2 And $FeldSt[5] = 2 And $FeldSt[1] = 1 Then _ArrayAdd($FeldRem, 1)
    If $FeldSt[7] = 2 And $FeldSt[5] = 2 And $FeldSt[3] = 1 Then _ArrayAdd($FeldRem, 3)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[4] = 2 And $FeldSt[5] = 2 And $FeldSt[6] = 1 Then _ArrayAdd($FeldRem, 6)
    If $FeldSt[6] = 2 And $FeldSt[5] = 2 And $FeldSt[4] = 1 Then _ArrayAdd($FeldRem, 4)
    If $FeldSt[2] = 2 And $FeldSt[5] = 2 And $FeldSt[7] = 1 Then _ArrayAdd($FeldRem, 7)
    If $FeldSt[7] = 2 And $FeldSt[5] = 2 And $FeldSt[3] = 1 Then _ArrayAdd($FeldRem, 3)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;wenn 2 Kreise
    For $i = 1 To 3 ;zählt 3mal, damit die priorität höher ist
    If $FeldSt[1] = 3 And $FeldSt[3] = 3 And $FeldSt[2] = 1 Then _ArrayAdd($FeldRem, 2)
    If $FeldSt[4] = 3 And $FeldSt[6] = 3 And $FeldSt[5] = 1 Then _ArrayAdd($FeldRem, 5)
    If $FeldSt[7] = 3 And $FeldSt[9] = 3 And $FeldSt[8] = 1 Then _ArrayAdd($FeldRem, 8)

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 3 And $FeldSt[7] = 3 And $FeldSt[4] = 1 Then _ArrayAdd($FeldRem, 4)
    If $FeldSt[2] = 3 And $FeldSt[8] = 3 And $FeldSt[5] = 1 Then _ArrayAdd($FeldRem, 5)
    If $FeldSt[3] = 3 And $FeldSt[9] = 3 And $FeldSt[6] = 1 Then _ArrayAdd($FeldRem, 6)

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 3 And $FeldSt[9] = 3 And $FeldSt[5] = 1 Then _ArrayAdd($FeldRem, 5)
    If $FeldSt[3] = 3 And $FeldSt[7] = 3 And $FeldSt[5] = 1 Then _ArrayAdd($FeldRem, 5)

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[1] = 3 And $FeldSt[5] = 3 And $FeldSt[9] = 1 Then _ArrayAdd($FeldRem, 9)
    If $FeldSt[3] = 3 And $FeldSt[5] = 3 And $FeldSt[7] = 1 Then _ArrayAdd($FeldRem, 7)
    If $FeldSt[9] = 3 And $FeldSt[5] = 3 And $FeldSt[1] = 1 Then _ArrayAdd($FeldRem, 1)
    If $FeldSt[7] = 3 And $FeldSt[5] = 3 And $FeldSt[3] = 1 Then _ArrayAdd($FeldRem, 3)

    [/autoit] [autoit][/autoit] [autoit]

    If $FeldSt[4] = 3 And $FeldSt[5] = 3 And $FeldSt[6] = 1 Then _ArrayAdd($FeldRem, 6)
    If $FeldSt[6] = 3 And $FeldSt[5] = 3 And $FeldSt[4] = 1 Then _ArrayAdd($FeldRem, 4)
    If $FeldSt[2] = 3 And $FeldSt[5] = 3 And $FeldSt[7] = 1 Then _ArrayAdd($FeldRem, 7)
    If $FeldSt[7] = 3 And $FeldSt[5] = 3 And $FeldSt[3] = 1 Then _ArrayAdd($FeldRem, 3)

    [/autoit] [autoit][/autoit] [autoit]

    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;~ _ArrayDisplay($FeldRem, "Felder die Gewinn entscheiden");zeigt die Felder an, bei denen jemand gewinnen kann

    [/autoit] [autoit][/autoit] [autoit]

    If UBound($FeldRem) - 1 > 0 Then
    If Random() > 0.25 Then; Wahrscheinlichkeit für geziehlten Zug (umso kleiner der Wert desto besser der Computer) min. 0 , max. 1
    $Count = UBound($FeldRem) - 1
    If $Count = 1 Then
    $Random = 1
    Else
    $Random = Random(1, $Count, 1)
    EndIf
    $Random = $FeldRem[$Random]
    Else
    While 1
    $Random = Random(1, 9, 1)
    If $FeldSt[$Random] = 1 Then ExitLoop
    WEnd
    EndIf
    Else
    While 1
    $Random = Random(1, 9, 1)
    If $FeldSt[$Random] = 1 Then ExitLoop
    WEnd
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetData($Feld[$Random], "O")
    $FeldSt[$Random] = 3
    EndFunc ;==>_ComZug

    [/autoit]
  • Grafik ist gut, nur die KI ist noch nicht so ausgereift.
    hab jedes Spiel gewonnen und er setzt nicht gegen eine diagonale Möglichkeit.

    MfG Schnuffel

    "Sarkasmus ist die niedrigste Form des Witzes, aber die höchste Form der Intelligenz."
    Val McDermid

    ein paar Infos ...

    Wer mehr als "nur" Hilfe benötigt, kann sich gern im Forum "Programmieranfragen" an uns wenden. Wir helfen in allen Fällen, die die Forenregeln zulassen.

    Für schnelle Hilfe benötigen wir ein ! lauffähiges ! Script, dass wir als Demonstration des Problems testen können. Wer von uns erwartet ein Teilscript erstmal lauffähig zu bekommen, der hat
    1. keine wirkliche Not
    2. keinen Respekt vor Menschen die ihm in ihrer Freizeit Ihre Hilfe anbieten
    3. oder ist einfach nur faul und meint wir coden das für ihn

    In solchen Fällen erlaube ich mir, die Anfrage einfach zu ignorieren. ;)

  • ja ist mit absicht so...wenn der computer bei jedem zug weiß was er ziehen muss hast du ja schon 100 pro verloren oder es wird unentschieden...du könntest in zeile 399 die zahl mal anpassen...beschreibung steht daneben

  • ja ist mit absicht so...wenn der computer bei jedem zug weiß was er ziehen muss hast du ja schon 100 pro verloren oder es wird unentschieden...du könntest in zeile 399 die zahl mal anpassen...beschreibung steht daneben

    Wenn man den Trick raus hat kann man nicht mehr verlieren. Das Spiel hab ich schon zu oft gespielt ;) DIe Umsetzung ist aber gut.
    Einen Vorschlag hätte ich noch: Gewinn und Neustart in eine MsgBox, dann muss man nicht 2x OK klicken.

  • Joa echt coole Umsetzung.
    Jedoch könnte die KI besser sein.
    Und auch wenn die KI weiss, welcher Zug gemacht werden muss, kann man trotzdem gewinnen (kleine wahrscheinlichkeit)
    MfG. PrideRage

    Meine Projekte:
    ClipBoard Manager (beendet)
    Gutes ClipBoard Verwaltungs Programm mit nützlichen Funktionen.

    HTML Creator (beendet)
    Nützliches Tool um schnell ein eigenes HTML Dokument zu erstellen.

  • @ prog@ndy

    Zitat

    Wenn man den Trick raus hat kann man nicht mehr verlieren. Das Spiel hab ich schon zu oft gespielt


    Ich fürchte, da hast Du diesmal nicht ganz Recht.
    Wenn beide Spieler wissen wie das Spiel funktioniert, gibt es nur noch unentschieden.
    Es gibt keinen Anfang, mit dem Du einen Sieg "erzwingen kannst"
    Du bist immer auf einen Fehler deines Gegner's angewiesen.

    siehe auch: Wikipedia

    MfG Schnuffel

    "Sarkasmus ist die niedrigste Form des Witzes, aber die höchste Form der Intelligenz."
    Val McDermid

    ein paar Infos ...

    Wer mehr als "nur" Hilfe benötigt, kann sich gern im Forum "Programmieranfragen" an uns wenden. Wir helfen in allen Fällen, die die Forenregeln zulassen.

    Für schnelle Hilfe benötigen wir ein ! lauffähiges ! Script, dass wir als Demonstration des Problems testen können. Wer von uns erwartet ein Teilscript erstmal lauffähig zu bekommen, der hat
    1. keine wirkliche Not
    2. keinen Respekt vor Menschen die ihm in ihrer Freizeit Ihre Hilfe anbieten
    3. oder ist einfach nur faul und meint wir coden das für ihn

    In solchen Fällen erlaube ich mir, die Anfrage einfach zu ignorieren. ;)