Tic Tac Toe für 2 Spieler

DAFLO programming Forum
Verfügbare Informationen zu "Tic Tac Toe für 2 Spieler"

  • Qualität des Beitrags: 0 Sterne
  • Beteiligte Poster: daos06
  • Forum: DAFLO programming Forum
  • Forenbeschreibung: Forum für die Mitglieder der Programmierer-Gruppe DAFLO programming
  • aus dem Unterforum: RapidBatch
  • Antworten: 1
  • Forum gestartet am: Samstag 05.08.2006
  • Sprache: deutsch
  • Link zum Originaltopic: Tic Tac Toe für 2 Spieler
  • Letzte Antwort: vor 13 Jahren, 7 Monaten, 17 Tagen, 11 Stunden, 46 Minuten
  • Alle Beiträge und Antworten zu "Tic Tac Toe für 2 Spieler"

    Re: Tic Tac Toe für 2 Spieler

    daos06 - 12.08.2006, 20:01

    Tic Tac Toe für 2 Spieler
    Leider hat es noch keinen Computergegner, vll. progge ich es mal.

    Code: %Anfang

    rem --- creating code for widget "myDialog"
    newdialog 'myDialog', 'DIALOG', '120|100|200|150'
    letdialog 'myDialog', 'caption', 'Tic Tac Toe'

    rem --- creating code for widget "myWidget1"
    newdialog 'myDialog:myWidget1', 'GROUP', '80|0|10|90'
    letdialog 'myDialog:myWidget1', 'enabled', '0'

    rem --- creating code for widget "myWidget2"
    newdialog 'myDialog:myWidget2', 'GROUP', '40|20|140|15'
    letdialog 'myDialog:myWidget2', 'enabled', '0'

    rem --- creating code for widget "myWidget3"
    newdialog 'myDialog:myWidget3', 'GROUP', '40|50|140|15'
    letdialog 'myDialog:myWidget3', 'enabled', '0'

    rem --- creating code for widget "myWidget4"
    newdialog 'myDialog:myWidget4', 'GROUP', '125|0|10|90'
    letdialog 'myDialog:myWidget4', 'enabled', '0'

    rem --- creating code for widget "myWidget5"
    newdialog 'myDialog:myWidget5', 'BUTTON', '45|10|35|15'
    letdialog 'myDialog:myWidget5', 'enabled', '0'

    rem --- creating code for widget "myWidget6"
    newdialog 'myDialog:myWidget6', 'BUTTON', '90|10|35|15'
    letdialog 'myDialog:myWidget6', 'enabled', '0'

    rem --- creating code for widget "myWidget7"
    newdialog 'myDialog:myWidget7', 'BUTTON', '135|10|35|15'
    letdialog 'myDialog:myWidget7', 'enabled', '0'

    rem --- creating code for widget "myWidget8"
    newdialog 'myDialog:myWidget8', 'BUTTON', '45|40|35|15'
    letdialog 'myDialog:myWidget8', 'enabled', '0'

    rem --- creating code for widget "myWidget9"
    newdialog 'myDialog:myWidget9', 'BUTTON', '90|40|35|15'
    letdialog 'myDialog:myWidget9', 'enabled', '0'

    rem --- creating code for widget "myWidget10"
    newdialog 'myDialog:myWidget10', 'BUTTON', '135|40|35|15'
    letdialog 'myDialog:myWidget10', 'enabled', '0'

    rem --- creating code for widget "myWidget11"
    newdialog 'myDialog:myWidget11', 'BUTTON', '45|70|35|15'
    letdialog 'myDialog:myWidget11', 'enabled', '0'

    rem --- creating code for widget "myWidget12"
    newdialog 'myDialog:myWidget12', 'BUTTON', '90|70|35|15'
    letdialog 'myDialog:myWidget12', 'enabled', '0'

    rem --- creating code for widget "myWidget13"
    newdialog 'myDialog:myWidget13', 'BUTTON', '135|70|35|15'
    letdialog 'myDialog:myWidget13', 'enabled', '0'

    rem --- make the dialog window visible
    letdialog 'myDialog', 'visible', [true]

    [x] = '1'
    repeat
    rem Dialog starten
    rundialog [event] = '0'



    rem Ereignis auswerten
    if [event] = 'click_myDialog:myWidget5'
       deldialog 'myDialog:myWidget5'
       newdialog 'myDialog:myWidget5', 'Label', '45|10|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget5', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget5', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget5', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget5', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget5', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget5', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget5', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget5', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget5', 'caption', ' X'
          [x] + '1'
        endif
        getdialog [a] = 'myDialog:myWidget5', 'caption'
    endif 

    if [event] = 'click_myDialog:myWidget6'
       deldialog 'myDialog:myWidget6'
       newdialog 'myDialog:myWidget6', 'Label', '90|10|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget6', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget6', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget6', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget6', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget6', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget6', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget6', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget6', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget6', 'caption', ' X'
          [x] + '1'
       endif
       getdialog [b] = 'myDialog:myWidget6', 'caption'
    endif

    if [event] = 'click_myDialog:myWidget7'
       deldialog 'myDialog:myWidget7'
       newdialog 'myDialog:myWidget7', 'Label', '135|10|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget7', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget7', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget7', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget7', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget7', 'caption', ' X' 
          [x] + '1'
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget7', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget7', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget7', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget7', 'caption', ' X'
          [x] + '1'
       endif
       getdialog [c] = 'myDialog:myWidget7', 'caption'
    endif

    if [event] = 'click_myDialog:myWidget8'
       deldialog 'myDialog:myWidget8'
       newdialog 'myDialog:myWidget8', 'Label', '45|40|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget8', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget8', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget8', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget8', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget8', 'caption', ' X' 
          [x] + '1'
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget8', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget8', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget8', 'caption', ' O' 
          [x] + '1'
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget8', 'caption', ' X'
          [x] + '1'
       endif
       getdialog [d] = 'myDialog:myWidget8', 'caption'
    endif

    if [event] = 'click_myDialog:myWidget9'
       deldialog 'myDialog:myWidget9'
       newdialog 'myDialog:myWidget9', 'Label', '90|40|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget9', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget9', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget9', 'caption', ' X' 
          [x] + '1'
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget9', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget9', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget9', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget9', 'caption', ' X' 
          [x] + '1'
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget9', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget9', 'caption', ' X'
          [x] + '1'
        endif
        getdialog [e] = 'myDialog:myWidget9', 'caption'
    endif

    if [event] = 'click_myDialog:myWidget10'
       deldialog 'myDialog:myWidget10'
       newdialog 'myDialog:myWidget10', 'Label', '135|40|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget10', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget10', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget10', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget10', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget10', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget10', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget10', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget10', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget10', 'caption', ' X'
          [x] + '1'
       endif
       getdialog [f] = 'myDialog:myWidget10', 'caption'
    endif

    if [event] = 'click_myDialog:myWidget11'
       deldialog 'myDialog:myWidget11'
       newdialog 'myDialog:myWidget11', 'Label', '45|70|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget11', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget11', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget11', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget11', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget11', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget11', 'caption', ' O' 
          [x] + '1'
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget11', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget11', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget11', 'caption', ' X'
          [x] + '1'
       endif
       getdialog [g] = 'myDialog:myWidget11', 'caption'
    endif

    if [event] = 'click_myDialog:myWidget12'
       deldialog 'myDialog:myWidget12'
       newdialog 'myDialog:myWidget12', 'Label', '90|70|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget12', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget12', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget12', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget12', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget12', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget12', 'caption', ' O' 
          [x] + '1'
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget12', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget12', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget12', 'caption', ' X'
          [x] + '1'
       endif
       getdialog [h] = 'myDialog:myWidget12', 'caption'
    endif

    if [event] = 'click_myDialog:myWidget13'
       deldialog 'myDialog:myWidget13'
       newdialog 'myDialog:myWidget13', 'Label', '135|70|35|15'
       If [x] = '1'
          letdialog 'myDialog:myWidget13', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '2'
          letdialog 'myDialog:myWidget13', 'caption', ' O'
          [x] + '1'
       elseIf [x] = '3'
          letdialog 'myDialog:myWidget13', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '4'
          letdialog 'myDialog:myWidget13', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '5'
          letdialog 'myDialog:myWidget13', 'caption', ' X'
          [x] + '1' 
       elseIf [x] = '6'
          letdialog 'myDialog:myWidget13', 'caption', ' O'
          [x] + '1' 
       elseIf [x] = '7'
          letdialog 'myDialog:myWidget13', 'caption', ' X'
          [x] + '1'   
       elseIf [x] = '8'
          letdialog 'myDialog:myWidget13', 'caption', ' O'
          [x] + '1'   
       elseIf [x] = '9'
          letdialog 'myDialog:myWidget13', 'caption', ' X'
          [x] + '1'
       endif
       getdialog [i] = 'myDialog:myWidget13', 'caption'
    endif             




    If [a] = ' X' & [b] = ' X' & [c] = ' X'
    echo 'Spieler 1 hat gewonnen'
    [s] = '1'
    goto 'ende'
    endif
    If [d] = ' X' & [e] = ' X' & [f] = ' X'
    echo 'Spieler 1 hat gewonnen'
    [s] = '1'
    goto 'ende'
    endif
    If [g] = ' X' & [h] = ' X' & [i] = ' X'
    echo 'Spieler 1 hat gewonnen'
    [s] = '1'
    goto 'ende'
    endif
    If [a] = ' X' & [d] = ' X' & [g] = ' X'
    echo 'Spieler 1 hat gewonnen'
    [s] = '1'
    goto 'ende'
    endif
    If [b] = ' X' & [e] = ' X' & [h] = ' X'
    echo 'Spieler 1 hat gewonnen'
    [s] = '1'
    goto 'ende'
    endif
    If [c] = ' X' & [f] = ' X' & [i] = ' X'
    echo 'Spieler 1 hat gewonnen'
    [s] = '1'
    goto 'ende'
    endif
    If [a] = ' X' & [e] = ' X' & [i] = ' X'
    echo 'Spieler 1 hat gewonnen'
    [s] = '1'
    goto 'ende'
    endif
    If [g] = ' X' & [e] = ' X' & [c] = ' X'
    echo 'Spieler 1 hat gewonnen'
    [s] = '1'
    goto 'ende'
    endif

    If [a] = ' O' & [b] = ' O' & [c] = ' O'
    echo 'Spieler 2 hat gewonnen'
    [s] = '2'
    goto 'ende'
    endif
    If [d] = ' O' & [e] = ' O' & [f] = ' O'
    echo 'Spieler 2 hat gewonnen'
    [s] = '2'
    goto 'ende'
    endif
    If [g] = ' O' & [h] = ' O' & [i] = ' O'
    echo 'Spieler 2 hat gewonnen'
    [s] = '2'
    goto 'ende'
    endif
    If [a] = ' O' & [d] = ' O' & [g] = ' O'
    echo 'Spieler 2 hat gewonnen'
    [s] = '2'
    goto 'ende'
    endif
    If [b] = ' O' & [e] = ' O' & [h] = ' O'
    echo 'Spieler 2 hat gewonnen'
    [s] = '2'
    goto 'ende'
    endif
    If [c] = ' O' & [f] = ' O' & [i] = ' O'
    echo 'Spieler 2 hat gewonnen'
    [s] = '2'
    goto 'ende'
    endif
    If [a] = ' O' & [e] = ' O' & [i] = ' O'
    echo 'Spieler 2 hat gewonnen'
    [s] = '2'
    goto 'ende'
    endif
    If [g] = ' O' & [e] = ' O' & [c] = ' O'
    echo 'Spieler 2 hat gewonnen'
    [s] = '2'
    goto 'ende'
    endif

    If [event] = 'close_myDialog' halt

    until [x] = '10'

    echo 'Unentschieden!'
    confirm [quit] = 'Revanche?'
        If [quit] = [true] 
          deldialog 'myDialog:myWidget5'
          deldialog 'myDialog:myWidget6'
          deldialog 'myDialog:myWidget7'
          deldialog 'myDialog:myWidget8'
          deldialog 'myDialog:myWidget9'
          deldialog 'myDialog:myWidget10'
          deldialog 'myDialog:myWidget11'
          deldialog 'myDialog:myWidget12'
          deldialog 'myDialog:myWidget13'
          goto 'Anfang'   
          If [quit] = [false]
          halt
    endif


    %ende

    If [s] = '1' | [s] = '2'
       confirm [quit] = 'Revanche?'
       If [quit] = [true] 
          deldialog 'myDialog:myWidget5'
          deldialog 'myDialog:myWidget6'
          deldialog 'myDialog:myWidget7'
          deldialog 'myDialog:myWidget8'
          deldialog 'myDialog:myWidget9'
          deldialog 'myDialog:myWidget10'
          deldialog 'myDialog:myWidget11'
          deldialog 'myDialog:myWidget12'
          deldialog 'myDialog:myWidget13'
          reset [a]
          reset [b]
          reset [c]
          reset [d]
          reset [e]
          reset [f]
          reset [g]
          reset [h]
          reset [i]
          goto 'Anfang'
       if [quit] = [false]
          halt

    end



    Mit folgendem Code, können Sie den Beitrag ganz bequem auf ihrer Homepage verlinken



    Weitere Beiträge aus dem Forum DAFLO programming Forum

    Tic Tac Toe für 2 Spieler - gepostet von daos06 am Samstag 12.08.2006
    "Vista" top oder flop? - gepostet von daos06 am Dienstag 21.11.2006
    Neues Mitglied: Alien_Krieger! - gepostet von daos06 am Mittwoch 13.09.2006



    Ähnliche Beiträge wie "Tic Tac Toe für 2 Spieler"

    spieler bnd mit shinyu - luken (Sonntag 18.03.2007)
    Spieler des Monats - cracking (Freitag 22.06.2007)
    training am 5.3. - udalrich (Donnerstag 24.02.2011)
    Spielregeln für Spieler - Professor X (Samstag 10.06.2006)
    euer spieler black - Anonymous (Donnerstag 19.10.2006)
    Poker-Spieler gesucht - Christian (Montag 11.12.2006)
    [Darmstadt]Neuer Spieler - Tobias (Dienstag 03.07.2007)
    nervender spieler - crushy (Sonntag 11.06.2006)
    Tic Tac Toe: Erneute Trennung! - starbuck77 (Freitag 02.02.2007)
    Spielregeln für Spieler - phanteon (Sonntag 20.08.2006)