Introduction: Simple Batch Game

Here's a simple .bat game. It's not that good, but at least you'll have something to do when bored. :P
PS.: If you find any way to improve this code or any bugs/mistakes, please let me know by commenting down below.
Code:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

@echo off

:Start1
cls
echo Let's play a game!
echo It's called NUMBER!
echo For settings, type "Sets"
echo Choose any number
echo between 1 and 10:
set /p choice1=
if %choice1%==Sets goto Settings
for /l %%G in (1,1,10) do if %choice1%==%%G goto Add
echo Choose between 1
echo and 10!!
ping localhost -n >nul 3
goto Start1

:Add
if %choice1%==10 goto Tie
set one=1
set /a result=%choice1%+%one%
echo.
echo I choose %result%!
echo I win!
ping localhost -n >nul 3
goto Again1

:Tie
echo.
echo I choose 10!
echo Tie!
ping localhost -n >nul 3
goto Again1

:Again1
cls
echo.
echo Wanna play again? (y/n)
set /p answer=
if %answer%==y goto Start1
if %answer%==n exit
echo Choose y or n!
ping localhost -n >nul 3
goto Again1

:Settings
cls
echo.
echo Settings menu
echo -=-=-=-=-=-=-
echo 1) Always winning
echo 2) Always losing
set /p input=
if %input%==1 goto Win
if %input%==2 goto Loss
echo Choose 1 or 2!
ping localhost -n >nul 3
goto Settings

:Loss
echo Set to always losing.
ping localhost -n >nul 3
goto Start1

:Win
echo Set to always wining.
ping localhost -n >nul 3
goto Start2

:Start2
cls
echo Let's play a game!
echo It's called NUMBER!
echo For settings, type "Sets"
echo Choose any number
echo between 1 and 10:
set /p choice2=
if %choice2%==Sets goto Settings
for /l %%G in (1,1,10) do if %choice2%==%%G goto Sub
echo Choose between 1
echo and 10!!
ping localhost -n >nul 3
goto Start2

:Sub
if %choice2%==1 goto Tie
set one=1
set /a result=%choice2%-%one%
echo.
echo I choose %result%!
echo You win!
ping localhost -n >nul 3
goto Again2

:Tie
echo.
echo I choose 1!
echo Tie!
ping localhost -n >nul 3
goto Again2

:Again2
cls
echo.
echo Wanna play again? (y/n)
set /p answer2=
if %answer2%==y goto Start2
if %answer2%==n exit
echo Choose y or n!
ping localhost -n >nul 3
goto Again2

:Again1
cls
echo.
echo Wanna play again? (y/n)
set /p answer=
if %answer%==y goto Start1
if %answer%==n exit
echo Choose y or n!
ping localhost -n >nul 3
goto Again1

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Comments

author
Prof. Pickle made it! (author)2012-12-30

Well, some instructions would have been nice....

To be honest, this game isn't good at all. The scripting and readability of the code isn't great either.

May I suggest a new game:

You pick a number between 1 and whatever, and then the computer has to guess it.

I would make it myself but I got the inspiration from your instructable, so it's your call.

If you don't want to make it, let me know.

author
HunterWoodATL7 made it! (author)HunterWoodATL72015-11-16

https://www.instructables.com/id/Simple-Batch-Game-1/

Here is something I did with this, I credited you and Tetheu98

author
Tetheu98 made it! (author)2012-12-31

Well, I have just started with Batch and I'm not a pro (yet! :D), and this is my first "mini-batch-based-game", so it's not that good.
But guessing the number would be very easy, because when you have a variable written by the user (for example: set /p "input="), %input% becomes the value typed. For example, in the code above:

echo Choose any number
echo between 1 and 10:
set /p choice1=

If I typed 2, %choice1% would become 2. So guessing would be very easy, just by having "echo %input%". Please explain with more details if I didn't understand it right. :P
P.S: I could also make a Step by Step if you want

About This Instructable

3,612views

6favorites

License:

More by Tetheu98:Simple batch game
Add instructable to: