You are on page 1of 8

@echo off

title Guess It By yshasvee patel


setlocal enabledelayedexpansion
:menu
cls
echo Main Menu
echo To Play A Game, Press ycs
echo To Add new Words, Press ysh
echo To exit, Press 3
set /p menu=
if not defined menu goto menu
if /i %menu% equ ycs (
set menu=
goto Startgame
)
if /i %menu% equ ysh (
set menu=
goto addwords
)
if /i %menu% equ 3 (
set menu=
set finishing=1
goto :EOF
)
set menu=
goto menu

:addwords
cls
Echo Type the word you'd like to add to the dictionary and press enter.
set /p wordtoadd=""
if NOT defined wordtoadd (
goto addwords)

set justchecking=1
set wcheck=0

:wordadd
call :w%wcheck%
cls
if defined finishing (goto :EOF)
echo.>>Hangman.bat
echo :w%wcheck%>>Hangman.bat
echo set word=%wordtoadd%>>Hangman.bat
echo goto gotword>>Hangman.bat
set justchecking=
set wordtoadd=
set wcheck=
echo Word Added
pause>nul
goto menu

:goodcheck
set /a wcheck= %wcheck% + 1
goto wordadd

:startgame
cls
set hang=6
set /a randomnumber=%time:~9,2%
:numberadjustment
call :w%randomnumber%
if defined finishing (goto :EOF>nul)
cls
set /a randomnumber= ( %randomnumber% * ( ( %randomnumber% * 75 ) /100 ) ) /
( %randomnumber% + 14 ) + ( %randomnumber% * 4 ) / ( %randomnumber% * 3 )
if /i randomnumber GEQ 10 (
set randomnumber=%randomnumber:~0,2%
) ELSE (
set randomnumber=%randomnumber:~0,1%
)
goto numberadjustment

:gotword
if defined justchecking (goto goodcheck)
set letternumber=0
:lettersorting
set x=!letternumber!
set Letter%letternumber%=!word:~%x%,1!
set Space%letternumber%=_
if NOT "!Letter%letternumber%!"=="" (
set /a letternumber= %letternumber% + 1
goto lettersorting
)

set space=
set /a spacenumber=0
:spacecalculator
set space=%space% #Space%spacenumber%#
set /a spacenumber= %spacenumber% + 1
if /i %spacenumber% equ %letternumber% (goto 1guess) else (goto spacecalculator)

:1guess
set score=0
set allguesses=letters:

:guess
cls
goto hang%hang%
:keepguessing
echo.
Echo Guess The Word: %space:#=!%
if %hang%==1 ( echo Last Guess!) else (
echo %Hang% Guesses Left
)
echo You've guessed these %allguesses%
echo.
echo Guess Your Letter
set guess=
Set /p guess=
if not defined guess (goto guess)
set guess=%guess:~0,1%
if "%guess%"=="!" (goto guess)
echo You Guessed %guess%

if "%allguesses:~8%"=="" goto SkipCheckAlreadyGuess


echo %allguesses:~8% | find /i "%guess%" >nul
if /i %errorlevel% equ 0 (
echo You've already guessed that.
pause>nul
goto guess
)

:SkipCheckAlreadyGuess

set allguesses=%allguesses% %guess%

set poonumber=%letternumber%
if not defined score (set score=3)
if not defined oldscore (set oldscore=0)

:processguess
set verifyletter=!Letter%poonumber%!
if /i "%guess%"=="%verifyletter%" (
set /a score= !score! + 1
goto letteradjust
)
goto resume

:letteradjust
set Space%poonumber%=!Letter%poonumber%!
set !Letter%poonumber%=LETTERDONE

:resume
set /a poonumber=%poonumber% - 1
if /i %poonumber% lss 0 (goto noletter)
goto processguess

:noletter
if /i %score% GTR %oldscore% (goto gotletter)
Echo Sorry, wrong.
set /a hang= !hang! - 1
if !hang!==0 (goto dead)
pause>nul
set /a oldscore= %score%
cls
goto guess

:gotletter
echo Well done!and continue to play the game made by yshasvee patel
if %letternumber%==%score% (goto win)
pause>nul
set /a oldscore= %score%
goto guess

:dead
cls
echo Sorry, you died.
echo The word was "%word%".
pause>nul
goto endofall

:win
cls
echo You Won! and thanks for playing this game made by YSHASVEE PATEL
echo The word was "%word%"!
echo Well done!
pause>nul

:endofall
set space=
set cheddar=
set word=
set oldscore=
set score=
set letternumber=
set poonumber=
set spacenumber=
set anotherword=
set randomnumber=
set hang=
set guess=
set verifyletter=
set x=0
:endset
if defined Letter%x% (
set Letter%x%=
set /a x= %x% + 1
goto endset
)
set x=0
:endset2
if defined Space%x% (
set Letter%x%=
set /a x= %x% + 1
goto endset2
)
set x=

:askagain
cls
echo Go to the menu (enter ycs) or quit (enter ysh)?
set /p cheddar=""
if not defined cheddar goto askagain
if %cheddar%==ycs (
set cheddar=
goto menu)
if %cheddar%==ysh (
set finishing=1
goto :EOF)
goto askagain

:hang6
echo _____________________________
echo [ ]__________________(-)________]
echo [ ] / / (-)
echo [ ] / / (-)
echo [ ] / / _(_)_
echo [ ]/ / / *_* \
echo [ ] / ] ___ [
echo [ ] / \_____/
echo [ ]/
echo [ ]
echo [ ] yshasvee patel YSHASVEE chayan parth narayan vansh
echo [ ] ishta prathishta siddhant krish anita chirag atharv
echo [ ] somil shivam rajan manoj kumar patel tejasvi india
echo [ ]
echo [ ]
echo [ ]
echo [ ] I THINK THE GAME MADE BY YSHASVEE IS GOING TOUGH.

echo [_]_____________________________
echo [________________________________]
goto keepguessing

:hang5
echo _____________________________
echo [ ]__________________(-)________]
echo [ ] / / (-)
echo [ ] / / (-)
echo [ ] / / _(_)_
echo [ ]/ / / *_* \
echo [ ] / ] ___ [
echo [ ] / \_____/
echo [ ]/ [ ]
echo [ ] [ ]
echo [ ] [ ]
echo [ ] [_]
echo [ ] yshasvee patel YSHASVEE chayan parth narayan vansh
echo [ ] ishta prathishta siddhant krish anita chirag atharv
echo [ ] somil shivam rajan manoj kumar patel tejasvi india
echo [ ]
echo [ ] I THINK THE GAME MADE BY YSHASVEE IS GOING TOUGH.

echo [_]_____________________________
echo [________________________________]
goto keepguessing

:hang4
echo _____________________________
echo [ ]__________________(-)________]
echo [ ] / / (-)
echo [ ] / / (-)
echo [ ] / / _(_)_
echo [ ]/ / / *_* \
echo [ ] / ] ___ [
echo [ ] / \_____/
echo [ ]/ [ ]_______
echo [ ] [ ]_______]
echo [ ] [ ]
echo [ ] [_]
echo [ ]
echo [ ] yshasvee patel YSHASVEE chayan parth narayan vansh ishta prathishta
siddhant krish anita chirag atharv
echo [ ] somil shivam rajan manoj kumar patel tejasvi india
echo [ ]
echo [ ] I THINK THE GAME MADE BY YSHASVEE IS GOING TOUGH.

echo [_]_____________________________
echo [________________________________]
goto keepguessing

:hang3
echo _____________________________
echo [ ]__________________(-)________]
echo [ ] / / (-)
echo [ ] / / (-)
echo [ ] / / _(_)_
echo [ ]/ / / *_* \
echo [ ] / ] ___ [
echo [ ] / \_____/
echo [ ]/ _______[ ]_______
echo [ ] [_______[ ]_______]
echo [ ] [ ]
echo [ ] [_]
echo [ ]
echo [ ] yshasvee patel YSHASVEE chayan parth narayan vansh ishta prathishta
siddhant krish anita chirag atharv
echo [ ] somil shivam rajan manoj kumar patel tejasvi india
echo [ ]
echo [ ] I THINK THE GAME MADE BY YSHASVEE IS GOING TOUGH.

echo [_]_____________________________
echo [________________________________]
goto keepguessing

:hang2
echo _____________________________
echo [ ]__________________(-)________]
echo [ ] / / (-)
echo [ ] / / (-)
echo [ ] / / _(_)_
echo [ ]/ / / *_* \
echo [ ] / ] ___ [
echo [ ] / \_____/
echo [ ]/ _______[ ]_______
echo [ ] [_______[ ]_______]
echo [ ] [ ] yshasvee patel YSHASVEE chayan parth narayan vansh

echo [ ] [ ] ishta prathishta siddhant krish anita chirag


atharv
echo [ ] / _ \ somil shivam rajan manoj kumar patel tejasvi
india
echo [ ] /__ \ \
echo [ ] \ \
echo [ ] \_\
echo [ ] I THINK THE GAME MADE BY YSHASVEE IS GOING TOUGH.

echo [_]_____________________________
echo [________________________________]
goto keepguessing

:hang1
echo _____________________________
echo [ ]__________________(-)________]
echo [ ] / / (-)
echo [ ] / / (-)
echo [ ] / / _(_)_
echo [ ]/ / / *_* \
echo [ ] / ] ___ [
echo [ ] / \_____/
echo [ ]/ _______[ ]_______
echo [ ] [_______[ ]_______]
echo [ ] [ ] yshasvee patel YSHASVEE chayan parth narayan vansh
echo [ ] you [ ] ishta prathishta siddhant krish anita chirag atharv
echo [ ] died / _ \ somil shivam rajan manoj kumar patel tejasvi india
echo [ ] / / \ \
echo [ ] / / \ \
echo [ ] /_/ \_\
echo [ ]
echo [_]_____________________________
echo [________________________________]
goto keepguessing

:w0
set word=yshasvee YSHASVEE chayan parth narayan vansh atharv ishta prathishta
siddhant krish
goto gotword
:w1
set word=YSHASVEE
goto gotword
:w2
set word=chayan
goto gotword
:w3
set word=parth
goto gotword
:w4
set word=narayan
goto gotword
:w5
set word=vansh
goto gotword
:w6
set word=atharv
goto gotword
:w7
set word=ishta
goto gotword
:w8
set word=prathishta
goto gotword
:w9
set word=siddhant
goto gotword
:w10
set word=krish
goto gotword
:w11
set word=anita
goto gotword
:w12
set word=chirag
goto gotword
:w13
set word=somil
goto gotword
:w14
set word=shivam
goto gotword
:w15
set word=rajan
goto gotword
:w16
set word=manoj
goto gotword
:w17
set word=kumar
goto gotword
:w18
set word=patel
goto gotword
:w19
set word=tejasvi
goto gotword
:w20
set word=india
goto gotword
:w21
set word=
goto gotword

You might also like