Introduction: Simple Batch Game

This game is not my idea, but is a continuation of another instructable made by Tetheu98 and Prof. Pickle.

Here is the code, their are a few notes within the code, but if you have anymore questions just comment. I coded this in Notepad ++ to save time, but MicrosftVS or Codeblocks will also work, below are links to all three websites to download.

https://notepad-plus-plus.org/

https://www.visualstudio.com/en-us/visual-studio-homepage-vs.aspx

http://www.codeblocks.org/downloads

Here is Batch lang. Reference as well, if you wish to expand on the game (Its not really a game, more a file you can interact with.).

http://www.dostips.com/

(Bold and Italicized words are not in the code.)

____________________________________________________________________________________________

@echo off
@rem


rem 1.1 [denoting screen colors.]


color 3C


rem 1.2 [denoting title appearing on window.]


title Computer Magician!


rem 2.1 [Run is only initialized once at the start of the program.]


:Run
cls
echo ---------------------------------
echo - Welcome to Computer Magician! -
echo - -
echo - In this game your computer -
echo - will attemp to guess the -
echo - number you input. Press enter -
echo - to continue to the Menu. -
echo - -
echo ---------------------------------

When making this and the other dashed box, make sure the dashes line up to create a true box unlike in the code. use the picture as a reference.


rem 2.2 [DON NOT USE TABS WHEN CREATING TEXT BOXES, IT WILL CREATE PROBLEMS ON THE OUTER EDGE OF THE BOX.]


pause>nul


rem 3.1 [Menu is the Main Menu that can be called at any point of the game.]


:Menu
cls
echo.
echo Computer Magician!
echo ------------------
echo.
echo 1. To the game
echo 2. How to play
echo 3. Credits
echo 4. Exit
echo.
echo Type the number of your choice:


set /p UserInput=


if %UserInput%==1 goto Game
if %UserInput%==2 goto HTP
if %UserInput%==3 goto Credits
if %UserInput%==4 exit


rem 4.1 [Game is the section of code which will contain all the functions which will be required for the game to
rem 4.1 function, there will sub "classes" if you will (i'm just starting batch i'm a C++/C# and Java/JS guy).]


:Game
cls
echo.
echo Please input a number:


set /p UserInput=


cls
echo.
echo Your number was %UserInput%
echo.
echo Press 1 for me to guess again
echo Press 2 to return to the Menu
echo Press 3 to exit the Game
echo.


set /p UserInput=


if %UserInput%==1 goto Game
if %UserInput%==2 goto Menu
if %UserInput%==3 exit


rem 5.1 [HTP, stands for how to play, it is the instructions.]


:HTP
cls
echo -------------------------------------------------------
echo - The game is very simple, when select 1 from the menu-
echo - you will be promted to input a number. After you -
echo - input the number you will recieve a message from -
echo - your computer telling you what number you have -
echo - entered. Under the message you will be promted to -
echo - select another option, answer this question and -
echo - either your done, or playing again! -
echo -------------------------------------------------------


rem 5.2 [refer to rem 2.2]


pause> nul


goto Menu


rem 6.1 [Credits gives citation to Prof. Pickle and Tetheu98 for the Idea and Hunter Wood for Scripting
rem 6.1 and thanks the player for playing.]


:Credits
cls
echo.
echo Scripting: Hunter Wood
echo.
echo Idea: Tetheu98
echo Prof. Pickle
echo.
echo Thank You for playing Computer Magician!
echo.


pause>nul


goto Menu

_____________________________________________________________________________________________

Keep in mind this is a very, and I need to stress VERY simple Batch file/game. You can easily expand upon or remake this "game" to be very intricate and advanced.

The game is attached below.

Lastly here is a link to the original post by tetheu98

https://www.instructables.com/id/SImple-batch-game/