Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Double Dice - Random number game  (Read 16038 times)

0 Members and 1 Guest are viewing this topic.

jarjee

  • Guest
Double Dice - Random number game
« 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 »

Metal Messiah



    Beginner
  • Thanked: 3
    Re: Double Dice - Random number game
    « Reply #1 on: April 08, 2009, 02:46:44 PM »
    Could you explain what the ":1" and "GOTO 1" commands do please?

    Rgds,
    MM
    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



      Guru

    • Roar.
    • Thanked: 123
      • Yes
      • Yes
    • Computer: Specs
    • Experience: Familiar
    • OS: Windows 8
    Re: Double Dice - Random number game
    « 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 /?
    Where's MagicSpeed?
    Quote from: 'matt'
    He's playing a game called IRL. Great graphics, *censored* gameplay.

    Metal Messiah



      Beginner
    • Thanked: 3
      Re: Double Dice - Random number game
      « Reply #3 on: April 08, 2009, 03:14:51 PM »
      Many thanks :)

      Rgds,
      MM
      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



        Guru

      • Roar.
      • Thanked: 123
        • Yes
        • Yes
      • Computer: Specs
      • Experience: Familiar
      • OS: Windows 8
      Re: Double Dice - Random number game
      « Reply #4 on: April 08, 2009, 03:27:38 PM »
      Where's MagicSpeed?
      Quote from: 'matt'
      He's playing a game called IRL. Great graphics, *censored* gameplay.

      gh0std0g74



        Apprentice

        Thanked: 37
        Re: Double Dice - Random number game
        « 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.

        macdad-



          Expert

          Thanked: 40
          Re: Double Dice - Random number game
          « 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
          If you dont know DOS, you dont know Windows...

          Thats why Bill Gates created the Windows NT Family.

          BC_Programmer


            Mastermind
          • Typing is no substitute for thinking.
          • Thanked: 1140
            • Yes
            • Yes
            • BC-Programming.com
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Windows 11
          Re: Double Dice - Random number game
          « Reply #7 on: April 08, 2009, 07:39:19 PM »
          assuming of course they join CH again...
          I was trying to dereference Null Pointers before it was cool.

          millergram



            Rookie

            • Experience: Beginner
            • OS: Windows Vista
            Re: Double Dice - Random number game
            « 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