Batch Guessing Game

by lds221 in Circuits > Software

97 Views, 0 Favorites, 0 Comments

Batch Guessing Game

bandicam 2015-06-06 17-35-01-880.jpg

instructions:

1.copy and paste step 2's text in to notepad

2. save as "your_name.bat" the ".bat" is crucial to the function of this game

The Code

@echo off

color 0a

set/a one's=50

set/a two's=40

set/a three's=30

set/a four's=20

set/a five's=10

set/a six's=5

set/a seven's=1

echo Welcome to this useless two-player game in which one player picks a number

echo.

echo between 1 and 100 and the other player tries to guess it. Player 1 makes the

echo.

echo number and player 2 tries to guess it. You will be given NO hints or clues.

echo.

pause

cls

echo Enter the name for each player.

set/p "pone=Player one>"

echo.

set/p "ptwo=Player two>"

cls

goto ar

:busted

cls

echo I SAID a number between 1 and 100!

echo.

:ar

echo OK %ptwo%, look away. %pone%, type in the number and press enter.

set/p "deguess=>"

if %deguess% GTR 100 GOTO busted

cls

echo Choose a difficulty, %ptwo%:

echo.

echo (1) piece of cake-50 guesses

echo (2) easy-40 guesses

echo (3) moderate-30 guesses

echo (4) a little tricky-20 guesses

echo (5) hard-10 guesses

echo (6) insane-5 guesses

echo (7) impossible!-1 guess

echo.

echo Type the number of the difficulty you would like to play.

echo.

set/p "diff=>"

if %diff%==1 GOTO 1

if %diff%==2 GOTO 2

if %diff%==3 GOTO 3

if %diff%==4 GOTO 4

if %diff%==5 GOTO 5

if %diff%==6 GOTO 6

if %diff%==7 GOTO 7

:1

cls

goto br

:no21

cls

echo NOPE!

echo.

:br

echo Guess in the space below. You still have %one's% guesses.

set/p "guess41=>"

if %guess41%==%deguess% GOTO success

set/a one's=%one's%-1

if %one's%==0 GOTO failure

goto no21

:2

cls

goto cr

:no22

cls

echo NOPE!

echo.

:cr

echo Guess in the space below. You still have %two's% guesses.

set/p "guess42=>"

if %guess42%==%deguess% GOTO success

set/a two's=%two's%-1

if %two's%==0 GOTO failure

goto no22

:3

cls

goto dr

:no23

cls

echo NOPE!

echo.

:dr

echo Guess in the space below. You still have %three's% guesses.

set/p "guess43=>"

if %guess43%==%deguess% GOTO success

set/a three's=%three's%-1

if %three's%==0 GOTO failure

goto no23

:4

cls

goto er

:no24

cls

echo NOPE!

echo.

:er

echo Guess in the space below. You sill have %four's% guesses.

set/p "guess44=>"

if %guess44%==%deguess% GOTO success

set/a four's=%four's%-1

if %four's%==0 GOTO failure

goto no24

:5

cls

goto fr

:no25

cls

echo NOPE!

echo.

:fr

echo Guess in the space below. You still have %five's% guesses.

set/p "guess45=>"

if %guess45%==%deguess% GOTO success

set/a five's=%five's%-1

if %five's%==0 GOTO failure

goto no25

:6

cls

goto gr

:no26

cls

echo NOPE!

echo.

:gr

echo Guess in the space below. You have %six's% guesses left.

set/p "guess46=>"

if %guess46%==%deguess% GOTO success

set/a six's=%six's%-1

if %six's%==0 GOTO failure

goto no26

:7

cls

echo Guess in the space below. You only have %seven's% guess.

set/p "guess47=>"

if %guess47%==%deguess% GOTO success

goto failure

:success

cls

echo Well done, %ptwo%! You may now exit the game.

color 0c

color 09

color 0e

goto success

:failure

cls

echo %pone%'s number was too difficult. Sorry, %ptwo%.

echo.

echo The number was %deguess%.

echo.

pause

A Cheat?

none so far that i know but i made a guessing game on my ti-83 plus which contains a loophole (the code must be put in to a ti 80 type calculator)

code:

menu("pick","1P',1,"2P",2,)

lbl 1

clrhome

randInt(1,1000)-> n ((do not include) cant represent the arrow to declare the var)

disp "guess a number"

for(i,1,10)

input "guess",g

if n=g

then

disp "you got it!",guesses:",i

pause

stop

else

if n>g

then

disp "higher"

else

disp "lower"

end

end

end

disp "you lose!","the number was:",n

stop

lbl 2

disp "P2 pick a number","1-1000"

prompt n

if n>1000

goto 2

else

clrhome

disp "guess a number"
for(i,1,10)

input "guess",g

if n=g

then

disp "you got it!",guesses:",i,"num",n

pause

stop

else

if n>g

then

disp "higher"

else

disp "lower"

end

end

end

disp "you lose!","the number was:",n

stop

that's all the code

its a fun game with 2 modes 1 player 2 player

the cheat is when it says guess a number click alpha log/10x/N

n is the variable that contains the answer so each game mode has this loop hole