Although other people made this already I wanted to share my own RPS game
Note: This looks somewhat similar to Carbon Dudeoxide's RPS (Near beginning of thread) but I suppose that it's just a coincidence.
@echo off
:here
cls
title RPS by Shanked
set /a tries=0
set /a ctries=0
color 0a
echo Enter your name:
echo.
set /p name=
if "%name%"=="" goto :here
if "%name%"==" " goto :here
set A=%name%
set length=0
:loop
if defined A (set A=%A:~1%&set /A length += 1&goto loop)
set /a greater=10
if %length% GTR %greater% goto :too high
if %length% LEQ %greater% goto :top
:top
if %tries%==15 (
goto :winner
)
if %ctries%==15 (
goto :loser
)
cls
echo ROCK PAPER OR SCISSORS!
echo First one to reach 15 points WINS!
echo.
echo.
echo %name% has %tries% points.
echo The computer has %ctries% points.
echo.
if %tries%==14 (
echo One more point for %name%!
)
if %ctries%==14 (
echo One more point for the computer!
)
echo.
echo Choose Rock, Paper, or Scissors
echo.
echo R is Rock
echo P is Paper
echo S is Scissors
echo.
set /p option=
if "%option%"=="r" goto :rock
if "%option%"=="p" goto :paper
if "%option%"=="s" goto :scissors
if "%option%"=="R" goto :rock
if "%option%"=="P" goto :paper
if "%option%"=="S" goto :scissors
) else (
goto :top
)
)
goto :top
::~~~~~~~~~~~~~~~~~~ROCK
:rock
@echo off
cls
set /a TV=%random%%%3+1
if %TV% geq 3 goto :greaterrock
if %TV% equ 2 goto :equalrock
if %TV% leq 1 goto :lessrock
:greaterrock
cls
echo %name% chose Rock and Computer chose Paper
echo.
echo Computer wins
set /a ctries=%ctries +1
echo.
echo Computer gets a point
pause >nul
goto :top
:equalrock
cls
echo %name% chose Rock and Computer chose Rock too
echo.
echo It's a TIE
echo No points awarded
pause >nul
goto :top
:lessrock
cls
echo %name% chose Rock and Computer chose Scissors
echo.
echo You won
set /a tries=%tries +1
echo.
echo %name% gets a point
pause >nul
goto :top
::~~~~~~~~~~~~~~~~~PAPER
:paper
@echo off
cls
set /a TV1=%random%%%3+1
if %TV1% geq 3 goto :greaterpaper
if %TV1% equ 2 goto :equalpaper
if %TV1% leq 1 goto :lesspaper
:greaterpaper
cls
echo %name% chose Paper and Computer chose Scissors
echo.
echo Computer wins
set /a ctries=%ctries +1
echo.
echo Computer gets a point
pause >nul
goto :top
:equalpaper
cls
echo %name% chose Paper and Computer chose Paper too
echo.
echo It's a TIE
echo No points awarded
pause >nul
goto :top
:lesspaper
cls
echo %name% chose Paper and Computer chose Rock
echo.
echo You won
set /a tries=%tries +1
echo.
echo %name% gets a point
pause >nul
goto :top
::~~~~~~~~~~~~~~~~~~SCISSORS
:scissors
@echo off
cls
set /a TV2=%random%%%3+1
if %TV2% geq 3 goto :greatersci
if %TV2% equ 2 goto :equalsci
if %TV2% leq 1 goto :lesssci
:greatersci
cls
echo %name% chose Scissors and Computer chose Rock
echo.
echo Computer wins
set /a ctries=%ctries +1
echo.
echo Computer gets a point
pause >nul
goto :top
:equalsci
cls
echo %name% chose Scissors and Computer chose Scissors too
echo.
echo It's a TIE
echo No points awarded
pause >nul
goto :top
:lesssci
cls
echo %name% chose Scissors and Computer chose Paper
echo.
echo You won
set /a tries=%tries +1
echo.
echo %name% gets a point
pause >nul
goto :top
:winner
cls
echo Good Job! You won against the computer! :O
timeout 3 >nul
pause >nul
pause >nul
exit
:loser
cls
echo Wow you lost by a computer...you suck
pause >nul
pause >nul
exit
:too high
cls
color 0f
echo You have entered too many letters
echo.
echo Press any key to try again
pause >nul
cls
goto :here