Monday, March 23, 2020

Batch script code to create Game

Find the code / command here to create game using .bat file.

title Guess the Number!
color 0b
SET /a GuessLimit=6
ECHO Guess what Number I'm thinking of. (0-10)
SET /a GuessNum=0
SET /a Answer=%RANDOM%
if %Answer% gtr 10 goto begin
SET /p Guess=
SET /a GuessNum=%GuessNum%+1
IF %Guess%==cheat goto END
IF %Guess% LSS %Answer% ECHO My Number is Higher.
IF %Guess% GTR %Answer% ECHO My Number is Lower.
IF %Guess%==%Answer% GOTO END
IF %GuessNum% GTR %GuessLimit% (start
GOTO Retry
ECHO You are Correct!
echo The Answer was %Answer%
ECHO It took %GuessNum% Guesses.
echo Press any key to play again. :) pause>nul
goto start

No comments:

Post a Comment