How do you make a 50% chance that you can use in a batch game?
I am new to batch files, so please explain everything clearly.
If am doing something wrong, please tell me.
Please do not post replies like: “Do this, stupid.” because I am new to batch files.
@echo off
:command
echo ===============
echo 1.Rock
echo 2.Paper
echo 3.Scissors
echo ===============
I give the user the chance to choose between: “Rock”, “Paper”, or “Scissors”.
How do I make the batch file choose between the 3 randomly.
And after I add the chance, how do I set the win or lose?
,Thanks in advance
eXe
here is a batch game codes I now!
here it is:
:menu
@echo off
title Guess That Number!
echo type 1 to play
echo type 2 to exit
echo type 3 to play multiplayer
set /p C=
if “%C%”==”1” goto play
if “%C%”==”2” goto exit
if “%C%”==”3” goto multiplayer
if “%C%”==”%C%” goto invalid
:play
echo guess my favorite number 1 through 100!
set /p G=
if “%G%”==”none” goto win
if “%G%”==”%G%” goto lose
Exit
:multiplayer
echo do you want to see multiplayer instructions?
set /p MC=
if “%MC%”==”yes” goto M-instructions
if “%MC%”==”no” goto M-play
:M-instructions
echo the point of multiplayer in this game is to guess the correct number before the other player does! good luck!
pause
goto M-play
:M-play
set /p P1=type player 1’s name here:
set /p P2=type player 2’s name here:
echo %P1%
echo vs
echo %P2%
pause
echo to start multiplayer you need an extra player to choose the winning number!
pause
set /p N=type the winning number here:
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
echo loading…
pause
echo %P1%’s turn
echo guess my favorite number 1 through 100!
set /p MG=
if “%MG%”==”%N%” goto M-win
if “%MG%”==”%MG%” goto M-lose
:M-win
echo %MG% IS CORRECT!
echo %P1% WINS!
pause
Exit
:M-lose
echo I’m sorry, the answer %MG% is wrong. you lose!
echo %P1% LOSES!
pause
goto P2-M-play
:P2-M-play
echo %P2%’s turn
echo guess my favorite number 1 through 100!
set /p MGP2=
if “%MGP2%”==”%N%” goto P2-M-win
if “%MGP2%”==”%MGP2%” goto P2-M-lose
:p2-M-win
echo %MGP2% IS CORRECT!
echo %P2% WINS!
pause
Exit
:P2-M-lose
echo I’m sorry, the answer %G% is wrong. you lose!
echo TIE!
pause
echo and the wwinning number is…
pause
echo %N%!
pause
Exit
:win
echo %G% IS CORRECT!
pause
Exit
:lose
echo I’m sorry, the answer %G% is wrong. you lose!
pause
echo do you want to try again?
set /p Y=
if “%Y%”==”yes” goto play
if “%Y%”==”no” goto exit
if “%Y%”==”%Y%” goto invalid2
:exit
Exit
:invalid
echo I’m sorry but the command %C% is an invalid command.
pause
goto menu
:invalid2
echo I’m sorry but the command %Y% is an invalid command.
pause
goto lose
P.S. this is a guess the number game.
P.S.S. you can say this batch game is yours because I don’t have a website to post it on so that’s why I posted it. PEACE!