Home / Microsoft / Microsoft DOS / Double Dice - Random number game
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: Double Dice - Random number game  (Read 7259 times)
jarjee
Guest
« on: January 06, 2007, 06:30:44 AM »

When I was playing around with randomizing numbers in a certain limit, I had the idea for a game that I now call Double Dice.
Code: [Select]
@echo off
rem Double Dice by Jarjee 6/1/07
title Double Dice!
:S
echo Double Dice!
set money=100
echo.
:1
echo How much do you wager?
set /p wager=You have $%money%:
if /I %wager%==save goto :Score
if /I %wager%==highscore goto :High
if /I %wager%==help goto :Help
if /I %wager%==delete goto :Del
if /I %wager%==clear goto :Cls
if %wager% LSS 0 echo You can't wager a negative! &goto :1
if %wager% GTR %money% echo You don't have that money! &goto :1
set /a money="money-wager"
set /a DICE1=%random% %%6 + 1 >nul
echo You rolled a %DICE1%.
set /a DICE2=%random% %%6 + 1 >nul
echo You rolled a %DICE2%
if %DICE1%==%DICE2% goto :WIN!
echo.
if %money%==0 goto :F
goto :1
:F
echo Do you want to play again?(y/n)
set /p input=(y/n):
if /I %input%==y Cls &goto :S
if /I %input%==n goto :GO
goto :F
:WIN!
echo.
echo You Win! Here's your winnings!
echo.
set mem=%wager%
set /a wager="wager*6+wager"
set /a money="money+wager"
set /a wager="wager-mem"
echo You've won $%wager%!
set wager=0
echo.
goto :1
:GO
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
echo GAME OVER
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
ping 127.0.0.1 -n 1 >nul
echo.
echo.
:Score
set /p name=Type your name here:
echo %Name% : $%Money%>>Highscore.data
exit
:High
echo.
rem My thanks to SideWinder!
for /F "delims=" %%i in (Highscore.data) do @echo %%i
echo.
goto :1
:Help
echo.
echo Double Dice is a game of chance. If you get the same number twice,
echo the wager that you bet is returned sixfold. Otherwise you get nothing.
echo There are few commands in this program:
echo Save: This enters your profile into the highscore chart
echo Highscore: This loads the highscore if it is present
echo Delete: Removes the Highscore
echo Clear: Clears the screen
echo Help: Returns this information form.
echo.
goto :1
:Del
cls
del Highscore.data
goto :1
:Cls
cls
goto :1
This game covers keywords that you can type in during a wager. The help can be read by typing help in the wager input during a game. Also, if you can help with the high score, it would be appreciated (I want the score to go in numerical order, largest first.) Any suggestions will be helpful.

Are there another .bat based games out there?
« Last Edit: January 06, 2007, 07:00:09 AM by jarjee » IP logged
Metal Messiah
Beginner



Thanked: 3
Posts: 62




« Reply #1 on: April 08, 2009, 02:46:44 PM »

Could you explain what the ":1" and "GOTO 1" commands do please?

Rgds,
MM
IP logged

The time is near
The day has dawned
Be prepared
For what's to come.... Metal Messiah

From a Judas Priest song, guest where took my name from
Helpmeh
Egghead



Thanked: 116
Posts: 3,583

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #2 on: April 08, 2009, 02:49:00 PM »

Could you explain what the ":1" and "GOTO 1" commands do please?

Rgds,
MM

:1 is a label named 1
GOTO 1 will go to the label named 1

For information about GOTO run CMD and type GOTO /?
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Metal Messiah
Beginner



Thanked: 3
Posts: 62




« Reply #3 on: April 08, 2009, 03:14:51 PM »

Many thanks :)

Rgds,
MM
IP logged

The time is near
The day has dawned
Be prepared
For what's to come.... Metal Messiah

From a Judas Priest song, guest where took my name from
Helpmeh
Egghead



Thanked: 116
Posts: 3,583

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #4 on: April 08, 2009, 03:27:38 PM »

Many thanks :)

Rgds,
MM

No problem.
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
gh0std0g74
Apprentice



Thanked: 37
Posts: 590


« Reply #5 on: April 08, 2009, 06:08:30 PM »

Are there another .bat based games out there?
here's a more fun way to make games.
IP logged

macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #6 on: April 08, 2009, 07:10:07 PM »

This is also another topic you might want to post and visit  ;): http://www.computerhope.com/forum/index.php/topic,59426.0.html
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
BC_Programmer
Mastermind


Thanked: 682
Posts: 15,624

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #7 on: April 08, 2009, 07:39:19 PM »

assuming of course they join CH again...
IP logged

millergram
Rookie



Posts: 30

Experience: Beginner
OS: Windows Vista

« Reply #8 on: January 25, 2011, 08:09:41 PM »

Can i use that bat file for a larger bat file of my own will credit you of course
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / Double Dice - Random number game « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.101 seconds with 20 queries.