Verfasst: 29.01.2006 23:46
Ich hab trotzdem gewonnen 

Haddu fein gemacht *klatsch*Badboy99 hat geschrieben:bekomm ich mal von irgendjemand ein dickes Lob
Code: Alles auswählen
; PureBasic Visual Designer v3.80 build 1249
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#OL
#OM
#OR
#ML
#MM
#MR
#UL
#UM
#UR
#NAchricht
#Spielende
#Neustart
#Stand
EndEnumeration
;- Fonts
;
Global FontID1
FontID1 = LoadFont(1, "Arial", 24)
Global FontID2
FontID2 = LoadFont(2, "Arial", 12)
Procedure Open_Window_0()
If OpenWindow(#Window_0, 216, 0, 190, 275, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Tic Tac Toe")
If CreateGadgetList(WindowID())
ButtonGadget(#OL, 10, 10, 50, 50, "")
SetGadgetFont(#OL, FontID1)
ButtonGadget(#OM, 70, 10, 50, 50, "")
SetGadgetFont(#OM, FontID1)
ButtonGadget(#OR, 130, 10, 50, 50, "")
SetGadgetFont(#OR, FontID1)
ButtonGadget(#ML, 10, 70, 50, 50, "")
SetGadgetFont(#ML, FontID1)
ButtonGadget(#MM, 70, 70, 50, 50, "")
SetGadgetFont(#MM, FontID1)
ButtonGadget(#MR, 130, 70, 50, 50, "")
SetGadgetFont(#MR, FontID1)
ButtonGadget(#UL, 10, 130, 50, 50, "")
SetGadgetFont(#UL, FontID1)
ButtonGadget(#UM, 70, 130, 50, 50, "")
SetGadgetFont(#UM, FontID1)
ButtonGadget(#UR, 130, 130, 50, 50, "")
SetGadgetFont(#UR, FontID1)
ButtonGadget(#Neustart, 10, 220, 80, 30, "Neues Spiel")
ButtonGadget(#Spielende, 100, 220, 80, 30, "Spiel Beenden")
TextGadget(#NAchricht, 10, 190, 170, 20, "", #PB_Text_Center)
SetGadgetFont(#NAchricht, FontID2)
TextGadget(#stand,10,255,170,20,"Spieler 0 : 0 Computer",#PB_Text_Center)
EndIf
EndIf
EndProcedure
Open_Window_0()
If ReadFile(0, "Puntestand.txt")
playerdatei$ = ReadString()
computerdatei$ = ReadString()
CloseFile(0)
PlayerDatei.l=Val(Playerdatei$)
ComputerDatei.l=Val(Computerdatei$)
Player.l = ((((Playerdatei.l + 25) / 15) + 10) / 100)
Computer.l = ((((Computerdatei.l + 25) / 15) + 10) / 100)
Player$=Str(Player.l)
Computer$=Str(Computer.l)
Else
Player$ = "0"
Computer$ = "0"
EndIf
Player.l=Val(Player$)
Computer.l=Val(Computer$)
SetGadgetText(#stand,"Spieler "+Player$+" : "+Computer$+" Computer")
SetGadgetText(#Nachricht,"X ist dran")
Repeat
Event = WaitWindowEvent()
If OL.l > 0 And OM.l > 0 And ORR.l > 0 And ML.l > 0 And MM.l > 0 And MR.l > 0 And UL.l > 0 And UM.l > 0 And UR.l > 0
SetGadgetText(#Nachricht,"keiner hat gewonnen")
EndIf
If OL.l = 1 And OM.l = 1 And ORR.l = 1
SetGadgetText(#NAchricht,"O gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
ComputerA.l = 1
ElseIf ML.l = 1 And MM.l = 1 And MR.l = 1
SetGadgetText(#NAchricht,"O gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
ComputerA.l = 1
ElseIf UL.l = 1 And UM.l = 1 And UR.l = 1
SetGadgetText(#NAchricht,"O gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
ComputerA.l = 1
ElseIf OL.l = 1 And ML.l = 1 And UL.l = 1
SetGadgetText(#NAchricht,"O gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
ComputerA.l = 1
ElseIf OM.l = 1 And MM.l = 1 And UM.l = 1
SetGadgetText(#NAchricht,"O gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
ComputerA.l = 1
ElseIf ORR.l= 1 And MR.l = 1 And UR.l = 1
SetGadgetText(#NAchricht,"O gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
ComputerA.l = 1
ElseIf OL.l = 1 And MM.l = 1 And UR.l = 1
SetGadgetText(#NAchricht,"O gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
ComputerA.l = 1
ElseIf ORR.l= 1 And MM.l = 1 And UL.l = 1
SetGadgetText(#NAchricht,"O gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
ComputerA.l = 1
EndIf
If OL.l = 2 And OM.l = 2 And ORR.l = 2
SetGadgetText(#NAchricht,"X gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
PlayerA.l = 1
ElseIf ML.l = 2 And MM.l = 2 And MR.l = 2
SetGadgetText(#NAchricht,"X gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
PlayerA.l = 1
ElseIf UL.l = 2 And UM.l = 2 And UR.l = 2
SetGadgetText(#NAchricht,"X gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
PlayerA.l = 1
ElseIf OL.l = 2 And ML.l = 2 And UL.l = 2
SetGadgetText(#NAchricht,"X gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
PlayerA.l = 1
ElseIf OM.l = 2 And MM.l = 2 And UM.l = 2
SetGadgetText(#NAchricht,"X gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
PlayerA.l = 1
ElseIf ORR.l= 2 And MR.l = 2 And UR.l = 2
SetGadgetText(#NAchricht,"X gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
PlayerA.l = 1
ElseIf OL.l = 2 And MM.l = 2 And UR.l = 2
SetGadgetText(#NAchricht,"X gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
PlayerA.l = 1
ElseIf ORR.l= 2 And MM.l = 2 And UL.l = 2
SetGadgetText(#NAchricht,"X gewinnt")
DisableGadget(#OL,1) : DisableGadget(#OM,1) : DisableGadget(#OR,1) : DisableGadget(#ML,1) : DisableGadget(#MM,1) : DisableGadget(#MR,1) : DisableGadget(#UL,1) : DisableGadget(#UM,1) : DisableGadget(#UR,1)
Pl.l = 0
PlayerA.l = 1
EndIf
If PL.l = 1
; Spielerabfrage
; OR MM UL
If ORR.l = 1 And MM.l = 1 And UL.l = 0
KI.l = 7
ElseIf ORR.l = 1 And MM.l = 0 And UL.l = 1
KI.l = 5
ElseIf ORR.l = 0 And MM.l = 1 And UL.l = 1
KI.l = 3
; OL MM UR
ElseIf OL.l = 1 And MM.l = 1 And UR.l = 0
KI.l = 9
ElseIf OL.l = 1 And MM.l = 0 And UR.l = 1
KI.l = 5
ElseIf OL.l = 0 And MM.l = 1 And UR.l = 1
KI.l = 1
; OL OM OR
ElseIf OL.l = 1 And OM.l = 1 And ORR.l = 0
KI.l = 3
ElseIf OL.l = 1 And OM.l = 0 And ORR.l = 1
KI.l = 2
ElseIf OL.l = 0 And OM.l = 1 And ORR.l = 1
KI.l = 1
; ML MM MR
ElseIf ML.l = 1 And MM.l = 1 And MR.l = 0
KI.l = 6
ElseIf ML.l = 1 And MM.l = 0 And MR.l = 1
KI.l = 5
ElseIf ML.l = 0 And MM.l = 1 And MR.l = 1
KI.l = 4
; UL UM UR
ElseIf UL.l = 1 And UM.l = 1 And UR.l = 0
KI.l = 9
ElseIf UL.l = 1 And UM.l = 0 And UR.l = 1
KI.l = 8
ElseIf UL.l = 0 And UM.l = 1 And UR.l = 1
KI.l = 7
; OL ML UL
ElseIf OL.l = 1 And ML.l = 1 And UL.l = 0
KI.l = 7
ElseIf OL.l = 1 And ML.l = 0 And UL.l = 1
KI.l = 4
ElseIf OL.l = 0 And ML.l = 1 And UL.l = 1
KI.l = 1
; OM MM UM
ElseIf OM.l = 1 And MM.l = 1 And UM.l = 0
KI.l = 8
ElseIf OM.l = 1 And MM.l = 0 And UM.l = 1
KI.l = 5
ElseIf OM.l = 0 And MM.l = 1 And UM.l = 1
KI.l = 2
; OR MR UR
ElseIf ORR.l = 1 And MR.l = 1 And UR.l = 0
KI.l = 9
ElseIf ORR.l = 1 And MR.l = 0 And UR.l = 1
KI.l = 6
ElseIf ORR.l = 0 And MR.l = 1 And UR.l = 1
KI.l = 3
Else
; Gegnerabfrage
; OR MM UL
If ORR.l = 2 And MM.l = 2 And UL.l = 0
KI.l = 7
ElseIf ORR.l = 2 And MM.l = 0 And UL.l = 2
KI.l = 5
ElseIf ORR.l = 0 And MM.l = 2 And UL.l = 2
KI.l = 3
; OL MM UR
ElseIf OL.l = 2 And MM.l = 2 And UR.l = 0
KI.l = 9
ElseIf OL.l = 2 And MM.l = 0 And UR.l = 2
KI.l = 5
ElseIf OL.l = 0 And MM.l = 2 And UR.l = 2
KI.l = 1
; OL OM OR
ElseIf OL.l = 2 And OM.l = 2 And ORR.l = 0
KI.l = 3
ElseIf OL.l = 2 And OM.l = 0 And ORR.l = 2
KI.l = 2
ElseIf OL.l = 0 And OM.l = 2 And ORR.l = 2
KI.l = 1
; ML MM MR
ElseIf ML.l = 2 And MM.l = 2 And MR.l = 0
KI.l = 6
ElseIf ML.l = 2 And MM.l = 0 And MR.l = 2
KI.l = 5
ElseIf ML.l = 0 And MM.l = 2 And MR.l = 2
KI.l = 4
; UL UM UR
ElseIf UL.l = 2 And UM.l = 2 And UR.l = 0
KI.l = 9
ElseIf UL.l = 2 And UM.l = 0 And UR.l = 2
KI.l = 8
ElseIf UL.l = 0 And UM.l = 2 And UR.l = 2
KI.l = 7
; OL ML UL
ElseIf OL.l = 2 And ML.l = 2 And UL.l = 0
KI.l = 7
ElseIf OL.l = 2 And ML.l = 0 And UL.l = 2
KI.l = 4
ElseIf OL.l = 0 And ML.l = 2 And UL.l = 2
KI.l = 1
; OM MM UM
ElseIf OM.l = 2 And MM.l = 2 And UM.l = 0
KI.l = 8
ElseIf OM.l = 2 And MM.l = 0 And UM.l = 2
KI.l = 5
ElseIf OM.l = 0 And MM.l = 2 And UM.l = 2
KI.l = 2
; OR MR UR
ElseIf ORR.l = 2 And MR.l = 2 And UR.l = 0
KI.l = 9
ElseIf ORR.l = 2 And MR.l = 0 And UR.l = 2
KI.l = 6
ElseIf ORR.l = 0 And MR.l = 2 And UR.l = 2
KI.l = 3
; extra
ElseIf OL.l = 2 And MM.l = 0 And UR.l = 0 And OM.l = 0
KI.l = 2
ElseIf ORR.l = 2 And MM.l = 0 And UL.l = 0 And MR.l = 0
KI.l = 6
ElseIf UL.l = 2 And MM.l = 0 And ORR.l= 0 And ML.l = 0
KI.l = 4
ElseIf UR.l = 2 And MM.l = 0 And UL.l = 0 And UM.l = 0
KI.l = 8
; extra 2
ElseIf OM.l = 2 And MM.l = 0 And UM.l = 0
KI.l = 5
ElseIf ML.l = 2 And MM.l = 0 And MR.l = 0
KI.l = 5
ElseIf UM.l = 2 And MM.l = 0 And OM.l = 0
KI.l = 5
ElseIf MR.l = 2 And MM.l = 0 And ML.l = 0
KI.l = 5
; extra 3
Else
KI.l = Random(8)+1
EndIf
EndIf
If KI.l = 1
If OL.l = 0
DisableGadget(#OL, 1)
SetGadgetText(#OL,"O")
OL.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
ElseIf KI.l = 2
If OM.l = 0
DisableGadget(#OM, 1)
SetGadgetText(#OM,"O")
OM.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
ElseIf KI.l = 3
If ORR.l = 0
DisableGadget(#OR, 1)
SetGadgetText(#OR,"O")
ORR.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
ElseIf KI.l = 4
If ML.l = 0
DisableGadget(#ML, 1)
SetGadgetText(#ML,"O")
ML.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
ElseIf KI.l = 5
If MM.l = 0
DisableGadget(#MM, 1)
SetGadgetText(#MM,"O")
MM.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
ElseIf KI.l = 6
If MR.l = 0
DisableGadget(#MR, 1)
SetGadgetText(#MR,"O")
MR.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
ElseIf KI.l = 7
If UL.l = 0
DisableGadget(#UL, 1)
SetGadgetText(#UL,"O")
UL.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
ElseIf KI.l = 8
If UM.l = 0
DisableGadget(#UM, 1)
SetGadgetText(#UM,"O")
UM.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
ElseIf KI.l = 9
If UR.l = 0
DisableGadget(#UR, 1)
SetGadgetText(#UR,"O")
UR.l = 1
Pl.l = 0
SetGadgetText(#Nachricht,"X ist dran")
EndIf
EndIf
EndIf
If Event = #PB_EventCloseWindow
If PlayerA.l = 1
Player.l + 1
ElseIf ComputerA.l = 1
Computer.l + 1
EndIf
Player$=Str(Player.l)
Computer$=Str(Computer.l)
SetGadgetText(#Stand,"Spieler "+Player$+" : "+Computer$+" Computer")
PlayerA.l = 0
ComputerA.l = 0
PlayerDatei.l = ((((Player.l * 100) - 10) * 15) - 25)
ComputerDatei.l = ((((Computer.l * 100) - 10) * 15) - 25)
PlayerDatei$=Str(PlayerDatei.l)
ComputerDatei$=Str(ComputerDatei.l)
CreateFile(0, "Puntestand.txt")
WriteStringN(PlayerDatei$)
WriteStringN(ComputerDatei$)
CloseFile(0)
End Quit = 1
ElseIf Event = #PB_Event_Gadget
Select EventGadgetID()
Case #OL
DisableGadget(#OL, 1)
If Pl.l = 0
SetGadgetText(#OL,"X")
OL.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #OM
DisableGadget(#OM, 1)
If Pl.l = 0
SetGadgetText(#OM,"X")
OM.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #OR
DisableGadget(#OR, 1)
If Pl.l = 0
SetGadgetText(#OR,"X")
ORR.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #ML
DisableGadget(#ML, 1)
If Pl.l = 0
SetGadgetText(#ML,"X")
ML.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #MM
DisableGadget(#MM, 1)
If Pl.l = 0
SetGadgetText(#MM,"X")
MM.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #MR
DisableGadget(#MR, 1)
If Pl.l = 0
SetGadgetText(#MR,"X")
MR.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #UL
DisableGadget(#UL, 1)
If Pl.l = 0
SetGadgetText(#UL,"X")
UL.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #UM
DisableGadget(#UM, 1)
If Pl.l = 0
SetGadgetText(#UM,"X")
UM.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #UR
DisableGadget(#UR, 1)
If Pl.l = 0
SetGadgetText(#UR,"X")
UR.l = 2
Pl.l = 1
SetGadgetText(#Nachricht,"O ist dran")
EndIf
Case #Spielende
If PlayerA.l = 1
Player.l + 1
ElseIf ComputerA.l = 1
Computer.l + 1
EndIf
Player$=Str(Player.l)
Computer$=Str(Computer.l)
SetGadgetText(#Stand,"Spieler "+Player$+" : "+Computer$+" Computer")
PlayerA.l = 0
ComputerA.l = 0
PlayerDatei.l = ((((Player.l * 100) - 10) * 15) - 25)
ComputerDatei.l = ((((Computer.l * 100) - 10) * 15) - 25)
PlayerDatei$=Str(PlayerDatei.l)
ComputerDatei$=Str(ComputerDatei.l)
CreateFile(0, "Puntestand.txt")
WriteStringN(PlayerDatei$)
WriteStringN(ComputerDatei$)
CloseFile(0)
End
Case #Neustart
DisableGadget(#OL,0) : SetGadgetText(#OL,"") : OL.l = 0
DisableGadget(#OM,0) : SetGadgetText(#OM,"") : OM.l = 0
DisableGadget(#OR,0) : SetGadgetText(#OR,"") : ORR.l = 0
DisableGadget(#ML,0) : SetGadgetText(#ML,"") : ML.l = 0
DisableGadget(#MM,0) : SetGadgetText(#MM,"") : MM.l = 0
DisableGadget(#MR,0) : SetGadgetText(#MR,"") : MR.l = 0
DisableGadget(#UL,0) : SetGadgetText(#UL,"") : UL.l = 0
DisableGadget(#UM,0) : SetGadgetText(#UM,"") : UM.l = 0
DisableGadget(#UR,0) : SetGadgetText(#UR,"") : UR.l = 0
SetGadgetText(#Nachricht,"X ist dran")
Pl.l = 0
If PlayerA.l = 1
Player.l + 1
ElseIf ComputerA.l = 1
Computer.l + 1
EndIf
Player$=Str(Player.l)
Computer$=Str(Computer.l)
SetGadgetText(#Stand,"Spieler "+Player$+" : "+Computer$+" Computer")
PlayerA.l = 0
ComputerA.l = 0
EndSelect
EndIf
Until Quit
10:1 für mich und einen *knuddel* für dich mein lieber.Badboy99 hat geschrieben:Bin voll down wegen dem Spießer!!!!!
Wenn jeder meine ICQ Nummer haben sollte, dann würde ich sieBadboy99 hat geschrieben:MonkeyBoogie: Hast du ICQ