106543
Goto Top

TicTacToe per Batch

Hi Leute, nettes kleines Batch-Scriptchen, womit man TicTacToe spielen kann face-smile
grade gefeunden als mir langweilig war ...
einfach den Code in eine .txt kopieren und in .bat umbenennen.
@Echo Off
::Tic Tac Toe Trainer v1.0
::Author: Sourcecodes.de
:Global
SetLocal EnableExtensions EnableDelayedExpansion
Set "b.s.-1=O" & Set "b.s.0= " & Set "b.s.1=X"  
Set/a "e.f.1=7,e.f.7=1,e.f.3=5,e.f.5=3"  
Set/a "e.c.1.a=0,e.c.1.b=2,e.c.3.a=0,e.c.3.b=6"  
Set/a "e.c.5.a=2,e.c.5.b=8,e.c.7.a=6,e.c.7.b=8"  
Set/a "c.d.0=8,c.d.8=0,c.d.2=6,c.d.6=2"  
Set/a "c.s.0.a=1,c.s.0.b=3,c.s.2.a=1,c.s.2.b=5"  
Set/a "c.s.6.a=3,c.s.6.b=7,c.s.8.a=5,c.s.8.b=7"  
Set "all=0 1 2 3 4 5 6 7 8" & Set "center=4"  
Set "corners=0 2 6 8" & Set "edges=1 3 5 7"  
Set "wp="0 1 2" "3 4 5" "6 7 8" "0 3 6""  
Set "wp=!wp! "1 4 7" "2 5 8" "0 4 8" "2 4 6""  
If Not Exist Mouse.exe Call :BMouse
Set/a "computer=ties=player=0"  
:Main
Title Tic Tac Toe Trainer by Sourcecodes.de
Echo.Tic Tac Toe Trainer by Sourcecodes.de
Echo.........................
Echo.Spiel mit der Maus
Echo.Für Beenden, STRG-C
Echo.Klicken zum fortfahren
Mouse > Nul 2>&1
Call :BMenu
Goto :Eof
:BMenu
Cls
Set/a "b=1"  
:Play
If !b! Equ 1 (Call :BComputr) Else Call :BPlayer
Echo.
Echo. Klicke zum fortfahren
Mouse.exe > nul
Set/a "b*=-1"  
Goto :Play
:IsCorner
For %%+ in (%corners%) Do If %~1 Equ %%+ Exit/b 1
Exit/b 0
:IsEdge
For %%+ in (%edges%) Do If %~1 Equ %%+ Exit/b 1
Exit/b 0
:IsCenter
For %%+ in (%center%) Do If %~1 Equ %%+ Exit/b 1
Exit/b 0
:BGame
For /L %%i in (0,1,8) Do Set/a "b[%%i]=0"  
Set/a "Over=0"  
Call :ShowBoard
Goto :Eof
:Winner
For %%+ in (%wp%) Do ( Call :_WinnerL %%~+
If !ErrorLevel! Neq 0 Exit/b !ErrorLevel!)
Exit/b 0
:_WinnerL
If !b[%~1]! Neq 0 (
If !b[%~1]! Equ !b[%~2]! If !b[%~3]! Equ !b[%~1]! Exit/b !b[%~1]!)
Exit/b 0
:Player
If !Over! Equ 1 Exit/b -1
Set/a "sel=-1,k=-1,c=0"  
Set "cas="  
For /f "tokens=1,2,3" %%a in ('Mouse.exe 2^>Nul') Do (  
Set "cas=%%b%%c"  
Set/a "c=%%a")  
If !c! Neq 1 Goto :Player
For %%a in (00 20 40 02 22 42 04 24 44) Do (
Set/a "sel+=1"  
If "%%a"=="!cas!" Set/a "k=!sel!")  
If !k! Equ -1 Goto :Player
If !b[%k%]! Equ 0 (Call :UpdatePos %k% %~1
Exit/b %k%)
Goto :Player
:ShowBoard
Cls
Echo.!b.s.%b%!^|!b.s.%b[1]%!^|!b.s.%b[2]%!
Echo.-----
Echo.!b.s.%b[3]%!^|!b.s.%b[4]%!^|!b.s.%b[5]%!
Echo.-----
Echo.!b.s.%b[6]%!^|!b.s.%b[7]%!^|!b.s.%b[8]%!
Echo.
Echo.  Computer     Unentschieden       Spieler
Echo.     !computer!                   !ties!          !player!
Goto :Eof
:WinBlock
If !Over! Equ 1 Exit/b -1
If %~1 Equ 1 (Set/a "_win_value=2,_lost_value=-2"  
) Else Set/a "_win_value=-2,_lost_value=2"  
Call :_WinBloc %~1 %_win_value%
If !wb_return! Neq -1 (Set/a "Over=1"  
) Else Call :_WinBloc %~1 %_lost_value%
Exit/b !wb_return!
:_WinBloc
Set/a "wb_return=-1"  
For %%+ in (%wp%) Do (Call :_SumLine %%~+ %~2
If ErrorLevel 1 (For %%- in (%%~+) Do (If !b[%%-]! Equ 0 (
Call :UpdatePos %%- %~1
Set/a "wb_return=%%-"  
Goto :_WinBloE))))
:_WinBloE
Goto :Eof
:_SumLine
Set/a "_sum_line=!b[%~1]!+!b[%~2]!+!b[%~3]!"  
If !_sum_line! Equ %~4 Exit/b 1
Exit/b 0
:FullBoard
For /L %%i in (0,1,8) Do If !b[%%i]! Equ 0 Exit/b 0
Exit/b 1
:RUpdatePos
Set "av="  
Set/a "cav=0"  
For %%+ in (!%~1!) Do If !b[%%+]! Equ 0 (
Set "av=!av! %%+"  
Set/a "cav+=1")  
If !cav! Equ 0 Exit/b -1
Set/a "rp=%random% %% !cav!+1"  
For /f "tokens=%rp%" %%+ in ("!av!") Do Set/a "rp=%%+"  
Call :UpdatePos !rp! %~2
Exit/b !ErrorLevel!
:UpdatePos
Set/a "b[%~1]=%~2"  
Call :Winner
Set "w=!ErrorLevel!"  
If !w! Equ 1 (If !b! Equ 1 (Set/a "computer+=1"  
) Else Set/a "player+=1") Else If !w! Equ -1 (  
If !b! Equ 1 (Set/a "player+=1") Else Set/a "computer+=1"  
) Else (Call :FullBoard
If ErrorLevel 1 Set/a "ties+=1")  
Call :ShowBoard
Exit/b %~1
:BPlayer
Call :BGame
Call :Player 1
Set/a "maxf=!ErrorLevel!"  
Call :IsCenter %maxf%
If ErrorLevel 1 (Call :RUpdatePos corners -1
For /l %%. in (1,1,4) Do (Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 If !Over! Equ 0 (
Call :RUpdatePos corners -1
If Not ErrorLevel 0 Call :RUpdatePos all -1))
) Else (Call :UpdatePos 4 -1
Call :Player 1
Set/a "maxc=0,maxe=0,maxcd=0,c1e1oc2nd=0"  
For /L %%+ in (0,1,8) Do If !b[%%+]! Equ 1 (Call :IsEdge %%+
If ErrorLevel 1 (Set/a "maxe+=1"  
) Else (Call :IsCorner %%+
If ErrorLevel 1 (Set/a "maxc+=1"  
For /f %%- in ("b[!c.d.%%+!]") Do (  
If !%%-! Equ 1 Set/a "maxcd=1"))))  
If !maxc! Equ 1 (Set/a "c1e1oc2nd=1"  
) Else If !maxc! Equ 2 If !maxcd! Equ 0 Set/a "c1e1oc2nd=1"  
If !c1e1oc2nd! Equ 1 (Call :WinBlock -1
If ErrorLevel 0 (Call :Player 1
Call :WinBlock -1
Set/a _res=!ErrorLevel!
If !Over! Equ 0 (If !_res! Neq -1 (Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 (Call :RUpdatePos all -1
Call :Player 1)) Else (Call :RUpdatePos edges -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1))) Else (
For %%+ in (%corners%) Do If !b[%%+]! Equ 1 (
Call :UpdatePos !c.d.%%+! -1)
Call :Player 1
Call :WinBlock -1
If ErrorLevel 0 (Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 (Call :RUpdatePos all -1
Call :Player 1) Else If !Over! Equ 0 (Call :Player 1
Call :RUpdatePos all -1)) Else (Call :RUpdatePos corners -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1
))) Else If !maxc! Equ 2 (Call :RUpdatePos edges -1
Call :Player 1
For /l %%+ in (1,1,2) Do (Call :WinBlock -1
If !Over! Equ 0 Call :Player 1)) Else (Set/a "eif=0"  
For %%+ in (%edges%) Do (
If !b[%%+]! Equ 1 For /f %%- in ("b[!e.f.%%+!]") Do (  
If !%%-! Equ 1 Set/a "eif=1"))  
If !eif! Equ 1 (Call :RUpdatePos edges -1
Call :Player 1
Call :WinBlock -1
If Not ErrorLevel 0 (Set/a "p=0"  
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in (  
"b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (  
If !p! Equ 0 If !%%a! Equ -1 (Call :UpdatePos %%+ -1
Set/a "p=1") Else If !p! Equ 0 If !%%b! Equ -1 (  
Call :UpdatePos %%+ -1
Set/a "p=1")))  
Call :Player 1
Call :WinBlock -1)) Else (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in (  
"b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (  
If !%%a! Equ 1 If !%%b! Equ 1 Call :UpdatePos %%+ -1))
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 (Call :RUpdatePos corners -1
Call :Player 1
Call :WinBlock -1
If !Over! Equ 0 Call :Player 1))))
Exit/b
:BComputr
Call :BGame
Call :RUpdatePos corners 1
Set/a "maxf=!ErrorLevel!"  
Call :Player -1
Set/a "minf=!ErrorLevel!"  
Call :IsCenter %minf%
If ErrorLevel 1 (Call :UpdatePos !c.d.%maxf%! 1
Call :Player -1
Set/a "minf=!ErrorLevel!"  
Call :IsCorner !minf!
If ErrorLevel 1 (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 Call :UpdatePos %%+ 1
Call :Player -1
Call :WinBlock 1) Else (For /L %%+ in (1,1,2) Do (
If !Over! Equ 0 (Call :WinBlock 1
Call :Player -1))
If !Over! Equ 0 Call :WinBlock 1)
Goto :Eof)
Call :IsCorner %minf%
If ErrorLevel 1 (Call :RUpdatePos corners 1
Call :Player -1
Call :WinBlock 1
If !Over! Equ 0 (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 Call :UpdatePos %%+ 1
Call :Player -1
Call :WinBlock 1)) Else (Call :UpdatePos 4 1
Call :Player -1
Call :WinBlock 1
If Not ErrorLevel 0 (
For %%+ in (%corners%) Do If !b[%%+]! Equ 0 (
For /f "tokens=1,2" %%a in (  
"b[!c.s.%%+.a!] b[!c.s.%%+.b!]") Do (  
If !%%a! Equ 0 If !%%b! Equ 0 Call :UpdatePos %%+ 1)))
Call :Player -1
Call :WinBlock 1)
Goto :Eof
:BMouse
If Exist Mouse.exe Goto :Eof
For %%b In (
"4D53434600000000E5020000000000002C000000000000000301010001000000000000"  
"00460000000100010052050000000000000000BB3CE87420004D6F7573652E65786500"  
"AE44DE4B97025205434B9D54CD6B1341149F4DABC46ABB117AF1204ED05E4422E8510F"  
"151D3FA0D5A1AD17A9A46B77DA0637BBCB66AA15142A6BA121047AD09B07FF88A2D14B"  
"02F6500F3D7A2B9883960DF4D0839420B5DB371FE9177ED561DFFCE6FDE6CD9BF9BD9D"  
"DDFE7B73A80D21D40E16C70855906ABDE8EF6D1AACEBD4872E347F64295D31FA96D243"  
"13B902F6036F3CB0F278D4725D8FE3070C07932ECEB9F8DA9D419CF76C96E9ECEC38A3"  
"735082509F91D893B78ECCB6A3C6E13D5CEF71E85260589F4E8C13EADC08ED204D2B5E"  
"B436D9A754EC366E836C18F25DFE07AD076DC390F7DC1FE6339C4DF1D661B416B4B70C"  
"42EA48C6B6B82574198A18307689DD7957B5FF3DE7DDE2B7E7AB4918CC95C90F1A8923"  
"870BED66956C52E836A8F916E80AC2BD8846B386984CC92BD210DDA78F72B978977395"  
"F5388E69E4404C916CC89822592E93262D419A6818F81269868BA9B05E0DEB5F147B5B"  
"B2CB3335F3C52191F4357465F29D56844A5A267515761E5CF31DA987CD84395340624D"  
"14360DB989F9B25654194C39917C2FD6CE261BA75B71897D711D3A2E21E3F4F6271519"  
"D61266B5FFEB5831A91CE5AF80DF18027DA5969C57527DAB7EDDB2004AF26A455C3C28"  
"1932A064CF643D934A4FF45855B74C56A98CA642AB285159E4B4E46C7709B8ED7DEE6F"  
"C671B870AC48D64A648D46D75502D839EE19C6E21B8D7BB8C6298D4F354E6B1CD1686B"  
"9CD0E848045A3EBFBB1FB378673C8FD5BD7EB38BFB09638E7FBDB60AFC22D867B015B0"  
"751DD701DFE809B0B36097D2078FCD171E8D063C633B0E387E9073F9180CB2A39ECB03"  
"CF19F385932D309EB57C3FCB9FF84C12E38CE7AD9C6B05E3E206B1A91C470F59E032E7"  
"E2059DEA06E383DCBE69B9B6C3947BD5730B9EC3FAE1A705C4E07E628059B6666EB9FE"  
"24BF227E245B") Do >>Mouse.exe (Echo.For b=1 To len^(%%b^) Step 2  
Echo WScript.StdOut.Write Chr^(CByte^("&H"^&Mid^(%%b,b,2^)^)^) : Next)  
Cscript /b /e:vbs Mouse.exe > Mouse.ex_
Expand -r Mouse.ex_ >nul 2>&1
Del Mouse.ex_ >nul 2>&1
Goto :Eof
Grüße
Exze face-smile

Content-ID: 204494

Url: https://administrator.de/contentid/204494

Ausgedruckt am: 23.11.2024 um 00:11 Uhr

Freund.der.Nacht
Freund.der.Nacht 05.04.2013 um 18:56:41 Uhr
Goto Top
Hallo Exze,

gib bitte auch die Quelle an, wo du das her hast:

http://sourcecodes.jimdo.com/batch-quellcodes/spiele/

MfG

Freund der Nacht
Lochkartenstanzer
Lochkartenstanzer 06.04.2013 um 21:33:47 Uhr
Goto Top
Da hätte es auch einfach ein "Link teilen" getan. Die Leser hier sind (meistens) in der Lage dem Link zu folgen und dann das dort geschriebene zu verstehen.

lks
Apop85
Apop85 07.04.2013, aktualisiert am 08.04.2013 um 14:23:04 Uhr
Goto Top
Hier eine etwas abgespecktere (einfacheres Script) Version von TicTacToe

Hab mal mittels Try&Eroor was rumgebastelt face-smile

Es gäbe wahrscheinich einige Wege die Schneller nach Rom führen würden als diese Doofen abfragen die ich gebastelt hab um zu Überprüfen ob das Feld schon besetzt ist...
Vorschläge sind immer Willkommen face-smile

Update: 08.04.2013 - 14:23 Uhr
echo off
TITLE _____-----TIC-----TAC-----TOE-----_____
mode con lines=30 cols=60
chcp 1252
COLOR 1F
set p1=0
set p2=0
set "SPACE=  "  
set "SPACE1= "  
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo.
echo.
echo.
echo.
echo Spieler 1 Bitte gib deinen Namen ein:
set /p s1=
echo.
echo Spieler 2 Bitte gib deinen Namen ein:
set /p s2=
echo.
goto PRESET

:PRESET
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set "a1=."  
set "a2=."  
set "a3=."  
set "a4=."  
set "a5=."  
set "a6=."  
set "a7=."  
set "a8=."  
set "a9=."  
set axa=X
set aoa=O
set rd=0
set a1x=%a1% & set "a1xr=%a1% "  
set a2x=%a2% & set "a2xr=%a2% "  
set a3x=%a3% & set "a3xr=%a3% "  
set a4x=%a4% & set "a4xr=%a4% "  
set a5x=%a5% & set "a5xr=%a5% "  
set a6x=%a6% & set "a6xr=%a6% "  
set a7x=%a7% & set "a7xr=%a7% "  
set a8x=%a8% & set "a8xr=%a8% "  
set a9x=%a9% & set "a9xr=%a9% "  
set a1o=%a1% & set "a1om=%a1% "  
set a2o=%a2% & set "a2om=%a2% "  
set a3o=%a3% & set "a3om=%a3% "  
set a4o=%a4% & set "a4om=%a4% "  
set a5o=%a5% & set "a5om=%a5% "  
set a6o=%a6% & set "a6om=%a6% "  
set a7o=%a7% & set "a7om=%a7% "  
set a8o=%a8% & set "a8om=%a8% "  
set a9o=%a9% & set "a9om=%a9% "  

echo.
echo.
echo.
echo.
echo Wer soll beginnen? X oder O?
set /p ausw=

if %ausw% == o goto SPIELER2
if %ausw% == x goto SPIELER1
goto PRESET

:SPIELER1
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo		%s1%		%p1%:%p2%		%s2% 
echo.
echo                       %s1% wählt
echo. 
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo              I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I
echo    X   X     I%a1om% %a1x% %a1o%I%a2om% %a2x% %a2o%I%a3om% %a3x% %a3o%I
echo     X X      I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I	
echo      X       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	1 I 2 I 3
echo     X X      I%a4x% %a4o% %a4xr%I%a5x% %a5o% %a5xr%I%a6x% %a6o% %a6xr%I	---------
echo    X   X     I%a4om% %a4x% %a4o%I%a5om% %a5x% %a5o%I%a6om% %a6x% %a6o%I	4 I 5 I 6
echo              I%a4x% %a4o% %a4xr%I%a5x% %a5o% %a5xr%I%a6x% %a6o% %a6xr%I	---------
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	7 I 8 I 9
echo              I%a7x% %a7o% %a7xr%I%a8x% %a8o% %a8xr%I%a9x% %a9o% %a9xr%I
echo              I%a7om% %a7x% %a7o%I%a8om% %a8x% %a8o%I%a9om% %a9x% %a9o%I
echo              I%a7x% %a7o% %a7xr%I%a8x% %a8o% %a8xr%I%a9x% %a9o% %a9xr%I
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo.
echo                     Runde: %rd%
echo. 
echo                     Wähle dein Feld
set /p choice=                         

if %choice% == d goto DEBUG
if %choice% == 1 if %aoa% == %a1% goto FAIL1
if %choice% == 1 if %axa% == %a1% goto FAIL2
if %choice% == 2 if %aoa% == %a2% goto FAIL1
if %choice% == 2 if %axa% == %a2% goto FAIL2
if %choice% == 3 if %aoa% == %a3% goto FAIL1
if %choice% == 3 if %axa% == %a3% goto FAIL2
if %choice% == 4 if %aoa% == %a4% goto FAIL1
if %choice% == 4 if %axa% == %a4% goto FAIL2
if %choice% == 5 if %aoa% == %a5% goto FAIL1
if %choice% == 5 if %axa% == %a5% goto FAIL2
if %choice% == 6 if %aoa% == %a6% goto FAIL1
if %choice% == 6 if %axa% == %a6% goto FAIL2
if %choice% == 7 if %aoa% == %a7% goto FAIL1
if %choice% == 7 if %axa% == %a7% goto FAIL2
if %choice% == 8 if %aoa% == %a8% goto FAIL1
if %choice% == 8 if %axa% == %a8% goto FAIL2
if %choice% == 9 if %aoa% == %a9% goto FAIL1
if %choice% == 9 if %axa% == %a9% goto FAIL2
if %choice% == 1 set a1=%axa% & goto PRUEX 
if %choice% == 2 set a2=%axa% & goto PRUEX
if %choice% == 3 set a3=%axa% & goto PRUEX
if %choice% == 4 set a4=%axa% & goto PRUEX
if %choice% == 5 set a5=%axa% & goto PRUEX
if %choice% == 6 set a6=%axa% & goto PRUEX
if %choice% == 7 set a7=%axa% & goto PRUEX
if %choice% == 8 set a8=%axa% & goto PRUEX
if %choice% == 9 set a9=%axa% & goto PRUEX
if %choice% == x goto START

:PRUEX
if %a1%==X set a1o=%SPACE1% & set a1x=%axa% & set "a1xr=%axa% " & set "a1om=%SPACE%"  
if %a2%==X set a2o=%SPACE1% & set a2x=%axa% & set "a2xr=%axa% " & set "a2om=%SPACE%"  
if %a3%==X set a3o=%SPACE1% & set a3x=%axa% & set "a3xr=%axa% " & set "a3om=%SPACE%"  
if %a4%==X set a4o=%SPACE1% & set a4x=%axa% & set "a4xr=%axa% " & set "a4om=%SPACE%"  
if %a5%==X set a5o=%SPACE1% & set a5x=%axa% & set "a5xr=%axa% " & set "a5om=%SPACE%"  
if %a6%==X set a6o=%SPACE1% & set a6x=%axa% & set "a6xr=%axa% " & set "a6om=%SPACE%"  
if %a7%==X set a7o=%SPACE1% & set a7x=%axa% & set "a7xr=%axa% " & set "a7om=%SPACE%"  
if %a8%==X set a8o=%SPACE1% & set a8x=%axa% & set "a8xr=%axa% " & set "a8om=%SPACE%"  
if %a9%==X set a9o=%SPACE1% & set a9x=%axa% & set "a9xr=%axa% " & set "a9om=%SPACE%"  

if %a1%==O set a1x=%SPACE1% & set a1o=%aoa% & set "a1xr=%aoa% " & set "a1xr=%SPACE%" & set "a1om=%aoa% "  
if %a2%==O set a2x=%SPACE1% & set a2o=%aoa% & set "a2xr=%aoa% " & set "a2xr=%SPACE%" & set "a2om=%aoa% "  
if %a3%==O set a3x=%SPACE1% & set a3o=%aoa% & set "a3xr=%aoa% " & set "a3xr=%SPACE%" & set "a3om=%aoa% "  
if %a4%==O set a4x=%SPACE1% & set a4o=%aoa% & set "a4xr=%aoa% " & set "a4xr=%SPACE%" & set "a4om=%aoa% "  
if %a5%==O set a5x=%SPACE1% & set a5o=%aoa% & set "a5xr=%aoa% " & set "a5xr=%SPACE%" & set "a5om=%aoa% "  
if %a6%==O set a6x=%SPACE1% & set a6o=%aoa% & set "a6xr=%aoa% " & set "a6xr=%SPACE%" & set "a6om=%aoa% "  
if %a7%==O set a7x=%SPACE1% & set a7o=%aoa% & set "a7xr=%aoa% " & set "a7xr=%SPACE%" & set "a7om=%aoa% "  
if %a8%==O set a8x=%SPACE1% & set a8o=%aoa% & set "a8xr=%aoa% " & set "a8xr=%SPACE%" & set "a8om=%aoa% "  
if %a9%==O set a9x=%SPACE1% & set a9o=%aoa% & set "a9xr=%aoa% " & set "a9xr=%SPACE%" & set "a9om=%aoa% "  


set /a rd=%rd%+1
if %a1% == X if %a2% == %a1% if %a2% == %a3% goto XWIN
if %a4% == X if %a5% == %a4% if %a5% == %a6% goto XWIN
if %a7% == X if %a8% == %a7% if %a8% == %a9% goto XWIN
if %a1% == X if %a4% == %a1% if %a4% == %a7% goto XWIN
if %a2% == X if %a5% == %a2% if %a5% == %a8% goto XWIN
if %a3% == X if %a6% == %a3% if %a6% == %a9% goto XWIN
if %a1% == X if %a5% == %a1% if %a5% == %a9% goto XWIN
if %a7% == X if %a5% == %a7% if %a5% == %a3% goto XWIN
if %rd% == 9 goto PAR
goto SPIELER2

:SPIELER2
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo		%s1%		%p1%:%p2%		%s2% 
echo.
echo                       %s2% wählt
echo. 
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo              I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I
echo     XxX      I%a1om% %a1x% %a1o%I%a2om% %a2x% %a2o%I%a3om% %a3x% %a3o%I
echo    X   X     I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I
echo    X   X     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	1 I 2 I 3
echo    X   X     I%a4x% %a4o% %a4xr%I%a5x% %a5o% %a5xr%I%a6x% %a6o% %a6xr%I	---------
echo     XXX      I%a4om% %a4x% %a4o%I%a5om% %a5x% %a5o%I%a6om% %a6x% %a6o%I	3 I 4 I 5
echo              I%a4x% %a4o% %a4xr%I%a5x% %a5o% %a5xr%I%a6x% %a6o% %a6xr%I	---------
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	7 I 8 I 9
echo              I%a7x% %a7o% %a7xr%I%a8x% %a8o% %a8xr%I%a9x% %a9o% %a9xr%I
echo              I%a7om% %a7x% %a7o%I%a8om% %a8x% %a8o%I%a9om% %a9x% %a9o%I
echo              I%a7x% %a7o% %a7xr%I%a8x% %a8o% %a8xr%I%a9x% %a9o% %a9xr%I
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo.
echo                     Runde: %rd%
echo. 
echo                     Wähle dein Feld
set /p choice=                             

if %choice% == d goto DEBUG
if %choice% == 1 if %aoa% == %a1% goto FAIL3
if %choice% == 1 if %axa% == %a1% goto FAIL4
if %choice% == 2 if %aoa% == %a2% goto FAIL3
if %choice% == 2 if %axa% == %a2% goto FAIL4
if %choice% == 3 if %aoa% == %a3% goto FAIL3
if %choice% == 3 if %axa% == %a3% goto FAIL4
if %choice% == 4 if %aoa% == %a4% goto FAIL3
if %choice% == 4 if %axa% == %a4% goto FAIL4
if %choice% == 5 if %aoa% == %a5% goto FAIL3
if %choice% == 5 if %axa% == %a5% goto FAIL4
if %choice% == 6 if %aoa% == %a6% goto FAIL3
if %choice% == 6 if %axa% == %a6% goto FAIL4
if %choice% == 7 if %aoa% == %a7% goto FAIL3
if %choice% == 7 if %axa% == %a7% goto FAIL4
if %choice% == 8 if %aoa% == %a8% goto FAIL3
if %choice% == 8 if %axa% == %a8% goto FAIL4
if %choice% == 9 if %aoa% == %a9% goto FAIL3
if %choice% == 9 if %axa% == %a9% goto FAIL4
if %choice% == 1 set a1=%aoa% & goto PRUEO
if %choice% == 2 set a2=%aoa% & goto PRUEO
if %choice% == 3 set a3=%aoa% & goto PRUEO
if %choice% == 4 set a4=%aoa% & goto PRUEO
if %choice% == 5 set a5=%aoa% & goto PRUEO
if %choice% == 6 set a6=%aoa% & goto PRUEO
if %choice% == 7 set a7=%aoa% & goto PRUEO
if %choice% == 8 set a8=%aoa% & goto PRUEO
if %choice% == 9 set a9=%aoa% & goto PRUEO
if %choice% == x goto START

:PRUEO
if %a1%==X set a1o=%SPACE1% & set a1x=%axa% & set "a1xr=%axa% " & set "a1om=%SPACE%"  
if %a2%==X set a2o=%SPACE1% & set a2x=%axa% & set "a2xr=%axa% " & set "a2om=%SPACE%"  
if %a3%==X set a3o=%SPACE1% & set a3x=%axa% & set "a3xr=%axa% " & set "a3om=%SPACE%"  
if %a4%==X set a4o=%SPACE1% & set a4x=%axa% & set "a4xr=%axa% " & set "a4om=%SPACE%"  
if %a5%==X set a5o=%SPACE1% & set a5x=%axa% & set "a5xr=%axa% " & set "a5om=%SPACE%"  
if %a6%==X set a6o=%SPACE1% & set a6x=%axa% & set "a6xr=%axa% " & set "a6om=%SPACE%"  
if %a7%==X set a7o=%SPACE1% & set a7x=%axa% & set "a7xr=%axa% " & set "a7om=%SPACE%"  
if %a8%==X set a8o=%SPACE1% & set a8x=%axa% & set "a8xr=%axa% " & set "a8om=%SPACE%"  
if %a9%==X set a9o=%SPACE1% & set a9x=%axa% & set "a9xr=%axa% " & set "a9om=%SPACE%"  

if %a1%==O set a1x=%SPACE1% & set a1o=%aoa% & set "a1xr=%aoa% " & set "a1xr=%SPACE%" & set "a1om=%aoa% "  
if %a2%==O set a2x=%SPACE1% & set a2o=%aoa% & set "a2xr=%aoa% " & set "a2xr=%SPACE%" & set "a2om=%aoa% "  
if %a3%==O set a3x=%SPACE1% & set a3o=%aoa% & set "a3xr=%aoa% " & set "a3xr=%SPACE%" & set "a3om=%aoa% "  
if %a4%==O set a4x=%SPACE1% & set a4o=%aoa% & set "a4xr=%aoa% " & set "a4xr=%SPACE%" & set "a4om=%aoa% "  
if %a5%==O set a5x=%SPACE1% & set a5o=%aoa% & set "a5xr=%aoa% " & set "a5xr=%SPACE%" & set "a5om=%aoa% "  
if %a6%==O set a6x=%SPACE1% & set a6o=%aoa% & set "a6xr=%aoa% " & set "a6xr=%SPACE%" & set "a6om=%aoa% "  
if %a7%==O set a7x=%SPACE1% & set a7o=%aoa% & set "a7xr=%aoa% " & set "a7xr=%SPACE%" & set "a7om=%aoa% "  
if %a8%==O set a8x=%SPACE1% & set a8o=%aoa% & set "a8xr=%aoa% " & set "a8xr=%SPACE%" & set "a8om=%aoa% "  
if %a9%==O set a9x=%SPACE1% & set a9o=%aoa% & set "a9xr=%aoa% " & set "a9xr=%SPACE%" & set "a9om=%aoa% "  

set /a rd=%rd%+1

if %a1% == O if %a2% == %a1% if %a2% == %a3% goto OWIN
if %a4% == O if %a5% == %a4% if %a5% == %a6% goto OWIN
if %a7% == O if %a8% == %a7% if %a8% == %a9% goto OWIN
if %a1% == O if %a4% == %a1% if %a4% == %a7% goto OWIN
if %a2% == O if %a5% == %a2% if %a5% == %a8% goto OWIN
if %a3% == O if %a6% == %a3% if %a6% == %a9% goto OWIN
if %a1% == O if %a5% == %a1% if %a5% == %a9% goto OWIN
if %a7% == O if %a5% == %a7% if %a5% == %a3% goto OWIN
if %rd% == 9 goto PAR
goto SPIELER1

:XWIN
cls
if %a1%==X set a1o=%axa% & set a1x=%axa% & set "a1xr=%axa% " & set "a1om=%axa% "  
if %a2%==X set a2o=%axa% & set a2x=%axa% & set "a2xr=%axa% " & set "a2om=%axa% "  
if %a3%==X set a3o=%axa% & set a3x=%axa% & set "a3xr=%axa% " & set "a3om=%axa% "  
if %a4%==X set a4o=%axa% & set a4x=%axa% & set "a4xr=%axa% " & set "a4om=%axa% "  
if %a5%==X set a5o=%axa% & set a5x=%axa% & set "a5xr=%axa% " & set "a5om=%axa% "  
if %a6%==X set a6o=%axa% & set a6x=%axa% & set "a6xr=%axa% " & set "a6om=%axa% "  
if %a7%==X set a7o=%axa% & set a7x=%axa% & set "a7xr=%axa% " & set "a7om=%axa% "  
if %a8%==X set a8o=%axa% & set a8x=%axa% & set "a8xr=%axa% " & set "a8om=%axa% "  
if %a9%==X set a9o=%axa% & set a9x=%axa% & set "a9xr=%axa% " & set "a9om=%axa% "  

if %a1%==O set a1x=. & set a1o=. & set "a1xr=. " & set "a1xr=." & set "a1om=. "  
if %a2%==O set a2x=. & set a2o=. & set "a2xr=. " & set "a2xr=." & set "a2om=. "  
if %a3%==O set a3x=. & set a3o=. & set "a3xr=. " & set "a3xr=." & set "a3om=. "  
if %a4%==O set a4x=. & set a4o=. & set "a4xr=. " & set "a4xr=." & set "a4om=. "  
if %a5%==O set a5x=. & set a5o=. & set "a5xr=. " & set "a5xr=." & set "a5om=. "  
if %a6%==O set a6x=. & set a6o=. & set "a6xr=. " & set "a6xr=." & set "a6om=. "  
if %a7%==O set a7x=. & set a7o=. & set "a7xr=. " & set "a7xr=." & set "a7om=. "  
if %a8%==O set a8x=. & set a8o=. & set "a8xr=. " & set "a8xr=." & set "a8om=. "  
if %a9%==O set a9x=. & set a9o=. & set "a9xr=. " & set "a9xr=." & set "a9om=. "  
set /a p1=%p1%+1
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo		%s1%		%p1%:%p2%		%s2% 
echo.
echo                       %s1% Gewinnt!
echo. 
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo              I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I
echo    X   X     I%a1om% %a1x% %a1o%I%a2om% %a2x% %a2o%I%a3om% %a3x% %a3o%I
echo     X X      I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I	
echo      X       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	1 I 2 I 3
echo     X X      I%a4x% %a4o% %a4x%I%a5x% %a5o% %a5xr%I%a6x% %a6o% %a6x%I	---------
echo    X   X     I%a4om% %a4x% %a4o%I%a5om% %a5x% %a5o%I%a6om% %a6x% %a6o%I	4 I 5 I 6
echo              I%a4x% %a4o% %a4x%I%a5x% %a5o% %a5xr%I%a6x% %a6o% %a6x%I	---------
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	7 I 8 I 9
echo              I%a7x% %a7o% %a7x%I%a8x% %a8o% %a8xr%I%a9x% %a9o% %a9x%I
echo              I%a7om% %a7x% %a7o%I%a8om% %a8x% %a8o%I%a9om% %a9x% %a9o%I
echo              I%a7x% %a7o% %a7x%I%a8x% %a8o% %a8xr%I%a9x% %a9o% %a9x%I
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo. 
echo                        %s1% Gewinnt!
echo.
echo           Wähle n fuer Neustart oder x für Exit
set /p choice=                         

if %choice% == n goto PRESET
if %choice% == x exit
if %choice% == d goto DEBUG

:OWIN
cls
if %a1%==O set a1o=%aoa% & set a1x=%aoa% & set "a1xr=%aoa% " & set "a1om=%aoa% "  
if %a2%==O set a2o=%aoa% & set a2x=%aoa% & set "a2xr=%aoa% " & set "a2om=%aoa% "  
if %a3%==O set a3o=%aoa% & set a3x=%aoa% & set "a3xr=%aoa% " & set "a3om=%aoa% "  
if %a4%==O set a4o=%aoa% & set a4x=%aoa% & set "a4xr=%aoa% " & set "a4om=%aoa% "  
if %a5%==O set a5o=%aoa% & set a5x=%aoa% & set "a5xr=%aoa% " & set "a5om=%aoa% "  
if %a6%==O set a6o=%aoa% & set a6x=%aoa% & set "a6xr=%aoa% " & set "a6om=%aoa% "  
if %a7%==O set a7o=%aoa% & set a7x=%aoa% & set "a7xr=%aoa% " & set "a7om=%aoa% "  
if %a8%==O set a8o=%aoa% & set a8x=%aoa% & set "a8xr=%aoa% " & set "a8om=%aoa% "  
if %a9%==O set a9o=%aoa% & set a9x=%aoa% & set "a9xr=%aoa% " & set "a9om=%aoa% "  

if %a1%==X set a1x=. & set a1o=. & set "a1xr=. " & set "a1xr=." & set "a1om=. "  
if %a2%==X set a2x=. & set a2o=. & set "a2xr=. " & set "a2xr=." & set "a2om=. "  
if %a3%==X set a3x=. & set a3o=. & set "a3xr=. " & set "a3xr=." & set "a3om=. "  
if %a4%==X set a4x=. & set a4o=. & set "a4xr=. " & set "a4xr=." & set "a4om=. "  
if %a5%==X set a5x=. & set a5o=. & set "a5xr=. " & set "a5xr=." & set "a5om=. "  
if %a6%==X set a6x=. & set a6o=. & set "a6xr=. " & set "a6xr=." & set "a6om=. "  
if %a7%==X set a7x=. & set a7o=. & set "a7xr=. " & set "a7xr=." & set "a7om=. "  
if %a8%==X set a8x=. & set a8o=. & set "a8xr=. " & set "a8xr=." & set "a8om=. "  
if %a9%==X set a9x=. & set a9o=. & set "a9xr=. " & set "a9xr=." & set "a9om=. "  
set /a p2=%p2%+1
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo		%s1%		%p1%:%p2%		%s2% 
echo.
echo                       %s2% Gewinnt
echo. 
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo              I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I
echo     XxX      I%a1om% %a1x% %a1o%I%a2om% %a2x% %a2o%I%a3om% %a3x% %a3o%I
echo    X   X     I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I
echo    X   X     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	1 I 2 I 3
echo    X   X     I%a4x% %a4o% %a4x%I%a5x% %a5o% %a5x%I%a6x% %a6o% %a6x%I	---------
echo     XXX      I%a4om% %a4x% %a4o%I%a5om% %a5x% %a5o%I%a6om% %a6x% %a6o%I	3 I 4 I 5
echo              I%a4x% %a4o% %a4x%I%a5x% %a5o% %a5x%I%a6x% %a6o% %a6x%I	---------
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	7 I 8 I 9
echo              I%a7x% %a7o% %a7x%I%a8x% %a8o% %a8x%I%a9x% %a9o% %a9x%I
echo              I%a7om% %a7x% %a7o%I%a8om% %a8x% %a8o%I%a9om% %a9x% %a9o%I
echo              I%a7x% %a7o% %a7x%I%a8x% %a8o% %a8x%I%a9x% %a9o% %a9x%I
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo. 
echo                        %s2% Gewinnt!
echo.
echo           Wähle n fuer Neustart oder x fuer Exit
set /p choice=                         

if %choice% == n goto PRESET
if %choice% == x exit
if %choice% == d goto DEBUG


:FAIL1
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo		%s1%		%p1%:%p2%		%s2% 
echo.
echo                       %s1% wählt
echo. 
echo.
echo             Dieses Feld gehört deinem Gegner!
echo                  Wähle ein anderes Feld
ping -n 4 localhost >NUL
goto SPIELER1

:FAIL2
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo		%s1%		%p1%:%p2%		%s2% 
echo.
echo                       %s1% wählt
echo. 
echo.
echo              Dieses Feld gehört dir bereits!
echo                  Wähle ein anderes Feld
ping -n 4 localhost >NUL
goto SPIELER1

:FAIL4
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo		%s1%		%p1%:%p2%		%s2% 
echo.
echo                       %s2% wählt
echo. 
echo.
echo             Dieses Feld gehört deinem Gegner!
echo                  Wähle ein anderes Feld
ping -n 4 localhost >NUL
goto SPIELER2

:FAIL3
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo		%s1%		%p1%:%p2%		%s2% 
echo.
echo                       %s2% wählt
echo. 
echo.
echo              Dieses Feld gehört dir bereits!
echo                  Wähle ein anderes Feld
ping -n 4 localhost >NUL
goto SPIELER2

:PAR
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo. 
echo.
echo                     Unentschieden!
echo. 
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo              I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I
echo    XXxXX     I%a1om% %a1x% %a1o%I%a2om% %a2x% %a2o%I%a3om% %a3x% %a3o%I
echo    XX XX     I%a1x% %a1o% %a1xr%I%a2x% %a2o% %a2x%I%a3x% %a3o% %a3xr%I
echo    X X X     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	1 I 2 I 3
echo    XX XX     I%a4x% %a4o% %a4xr%I%a5x% %a5o% %a5xr%I%a6x% %a6o% %a6xr%I	---------
echo    XXXXX     I%a4om% %a4x% %a4o%I%a5om% %a5x% %a5o%I%a6om% %a6x% %a6o%I	3 I 4 I 5
echo              I%a4x% %a4o% %a4xr%I%a5x% %a5o% %a5xr%I%a6x% %a6o% %a6xr%I	---------
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	7 I 8 I 9
echo              I%a7x% %a7o% %a7xr%I%a8x% %a8o% %a8xr%I%a9x% %a9o% %a9xr%I
echo              I%a7om% %a7x% %a7o%I%a8om% %a8x% %a8o%I%a9om% %a9x% %a9o%I
echo              I%a7x% %a7o% %a7xr%I%a8x% %a8o% %a8xr%I%a9x% %a9o% %a9xr%I
echo              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo. 
echo                      Unentschieden!
echo.
echo           Wähle n fuer Neustart oder x für Exit
set /p choice=                         

if %choice% == n goto PRESET
if %choice% == x exit
if %choice% == d goto DEBUG

:DEBUG
cls
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo                 TIC       TAC        TOE
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo.
echo 1 = %a1%			a1x/a1o = %a1x%/%a1o%
echo 2 = %a2%			a2x/a2o = %a2x%/%a2o%
echo 3 = %a3%			a3x/a3o = %a3x%/%a3o%
echo 4 = %a4%			a4x/a4o = %a4x%/%a4o%
echo 5 = %a5%			a5x/a5o = %a5x%/%a5o%
echo 6 = %a6%			a6x/a6o = %a6x%/%a6o%
echo 7 = %a7%			a7x/a7o = %a7x%/%a7o%
echo 8 = %a8%			a8x/a8o = %a8x%/%a8o%
echo 9 = %a9%			a9x/a9o = %a9x%/%a9o%
echo axa = %axa%			space = "%SPACE%"  
echo aoa = %aoa%			goto = %goto%
echo s1 = %s1%
echo s2 = %s2%
echo rd = %rd%
echo p1 = %p1%
echo p2 = %p2%
echo ausw = %ausw%
echo choice = %choice%
echo.

echo GOTO
set /p goto=

if %goto% == x goto START
goto %goto%

Viel spass face-smile werde dies wahrscheinlich als Easteregg bei anderen Batches hinterlegen

Grüsse
Biber
Biber 07.04.2013 um 16:01:38 Uhr
Goto Top
Moin Apop85,

zu deinen willkommenen Verbesserungsvorschlägen hätte ich was.
Um mal irgendwo anzufangen: was mich an diesem Teilschnipsel wundert, sind drei Punkte...
echo Wähle n fuer Neustart oder x für Exit
set /p choice=

if %choice% == n goto PRESET
if %choice% == j exit
if %choice% == d goto DEBUG
if %choice% == x goto START

1) dieser Block taucht mehrmals (gecopy&pasted) auf. Warum eigentlich?
2) Warum sagst du dem ärmsten Benutzer "x für Exit", um ihn damit in eine neue Runde zu starten?
3) wenn der hinterhältige User nun aber "nichts"/42/"?"/ENTER/ESCAPE eingibt: Wie robust reagiert dann deine "if %choice% =="-Auswertung?

Grüße
Biber

P.S. Bitte verwende die Codeformatierung, dann lassen sich auch Zeilennummern gezielt ansprechen.
Apop85
Apop85 07.04.2013 um 21:15:17 Uhr
Goto Top
1. und 2.
Stimmt, Sorry hab den Code aus einer anderen Batch rauskopiert bei welchem das Spiel als Easteregg gedacht ist daher waren da noch einige Unstimmigkeiten. Habs aber jetzt noch korrigiert.

3. Hehe was genau führt
"nichts"/42/"?"/ENTER/ESCAPE"  
genau aus? ich sehe es definiert choice als "nichts" aber was macht /42/"?"/ENTER/ESCAPE ?

Ich sehe es überspringt einfach die Eingabe und Trickst dadurch den Rundenzähler aus. Somit könnte man ein fehlerhaftes Unentschieden auslösen.

Kann ich eine solche Eingabe auf einfache weise unterdrücken?

P.S.

- Erledigt ;)