RockPaperScissors game Won't Work
Posted: 30 Dec 2010 12:12
i tried to write a game for my freinds to play but it wont work. here is the code could you look over it and check to see what the problem is.thanks in advance..BatMaster.
Code: Select all
@echo off &setlocal
title RockPaperScissors
GOTO rps1
:rps1
set"rps=123"
set/a x1=random%%%3
call set "spr=%%rps:~%x1%,1%%"
if %spr%=1 GOTO rock
if %spr%=2 GOTO paper
if %spr%=3 GOTO scissors
:rock
SET INPUT=
ECHO Make a choice
pause
SET /P input=rock/paper/scissors:
if "%input%" =="" GOTO rps1
if "%input%" =="rock" GOTO draw
if "%input%" =="paper" GOTO win
if "%input%" =="scissors" GOTO loss
:paper
SET INPUT=
ECHO Make a choice
pause
SET /P input=rock/paper/scissors:
if "%input%" =="" GOTO rps1
if "%input%" =="rock" GOTO loss
if "%input%" =="paper" GOTO draw
if "%input%" =="scissors" GOTO win
:scissors
SET INPUT=
ECHO Make a choice
pause
SET /P input=rock/paper/scissors:
if "%input%" =="" GOTO rps1
if "%input%" =="rock" GOTO win
if "%input%" =="paper" GOTO loss
if "%input%" =="scissors" GOTO draw
:win
ECHO You have won. play again
pause
set /p input=y/n:
if "%input%" =="" GOTO win
if "%input%" =="y" GOTO rps1
if "%input%" =="n" GOTO exit
:loss
ECHO You have been defeated. play again
pause
set /p input=y/n:
if "%input%" =="" GOTO loss
if "%input%" =="y" GOTO rps1
if "%input%" =="n" GOTO exit
:draw
ECHO The game ended in a draw. play again
pause
set /p input=y/n:
if "%input%" =="" GOTO draw
if "%input%" =="y" GOTO rps1
if "%input%" =="n" GOTO exit
:exit
pause
exit