1.

Solve : Need help with a game!?

Answer»

Hello i created this game but there are errors in it so can you help me
First: when a win situation happens the command don't work.
Second: if you win the score looks like "0 + 1" i want it to be 1.
Third: some times the PC choose a number i've already chosen and the command not working and the same if we choose a number that the PC have chosen.
Fourth: in draw (tie) situatoin nothing happend plus i want to reset the numbers when we draw (tie).

by HELPING me and if the game work your name will be LISTED as a secondary creator.


@echo off
set us=0
set cs=0
set a=1
set b=2
set c=3
set d=4
set e=5
set f=6
set g=7
set h=8
set i=9
echo.
set /p name= Enter your name:
set /p pm= Choose X or O:
if %pm%==X (set cm=O)
if %pm%==x (set cm=O)
if %pm%==O (set cm=X)
if %pm%==o (set cm=X)
:start
cls
echo.
echo = =
echo %g% = %h% = %i%
echo = =
echo =======================
echo = =
echo %d% = %e% = %f%
echo = =
echo =======================
echo = =
echo %a% = %b% = %c%
echo = =
echo.
echo.
echo Computer Score: %cs%
echo %name% Score: %us%
echo.
set /p ch= Enter an area number:
if %ch%==1 (set a=%pm%)
if %ch%==2 (set b=%pm%)
if %ch%==3 (set c=%pm%)
if %ch%==4 (set d=%pm%)
if %ch%==5 (set e=%pm%)
if %ch%==6 (set f=%pm%)
if %ch%==7 (set g=%pm%)
if %ch%==8 (set h=%pm%)
if %ch%==9 (set i=%pm%)
if %ch%==%cch% (echo The Computer have already choose this area)
if %ch%==T.K (goto twin)
if %ch%==Dragon (goto dwin)
:PC
set /a cch=(%Random% %%9)
if %cch%==1 (set a=%cm%)
if %cch%==2 (set b=%cm%)
if %cch%==3 (set c=%cm%)
if %cch%==4 (set d=%cm%)
if %cch%==5 (set e=%cm%)
if %cch%==6 (set f=%cm%)
if %cch%==7 (set g=%cm%)
if %cch%==8 (set h=%cm%)
if %cch%==9 (set i=%cm%)
if %cch%==%ch% (set cch=%cch%+1)
if %cch% gtr 9 (set cch=%cch%-2)
:pro
if %a%==%b%==%c%==%pm% (goto Win)
if %a%==%d%==%g%==%pm% (goto Win)
if %a%==%e%==%i%==%pm% (goto Win)
if %d%==%e%==%f%==%pm% (goto Win)
if %g%==%h%==%i%==%pm% (goto Win)
if %b%==%e%==%h%==%pm% (goto Win)
if %c%==%f%==%i%==%pm% (goto Win)
if %g%==%e%==%c%==%pm% (goto Win)
if %a%==%b%==%c%==%cm% (goto Loss)
if %a%==%d%==%g%==%cm% (goto Loss)
if %a%==%e%==%i%==%cm% (goto Loss)
if %d%==%e%==%f%==%cm% (goto Loss)
if %g%==%h%==%i%==%cm% (goto Loss)
if %b%==%e%==%h%==%cm% (goto Loss)
if %c%==%f%==%i%==%cm% (goto Loss)
if %g%==%e%==%c%==%cm% (goto Loss)
goto start
:Win
echo.
echo You Win this Round!
echo.
set /a us=%us% + 1
echo Press Any KEY to Play Again...
PAUSE > nul
goto start
:Loss
echo.
echo You Lost this Round!
echo.
set /a cs=%cs% + 1
echo Press Any key to Play Again...
pause > nul
goto start
:Draw
set a=1
set b=2
set c=3
set d=4
set e=5
set f=6
set g=7
set h=8
set i=9
echo.
echo You and the Computer Draw!
echo.
echo Press Any key to Play Again...
pause > nul
goto startIt should be more like;
Code: [Select]if %a%==%b% & %c%==%pm% (goto Win)
Or so I think.



Discussion

No Comment Found