Batch File Heads or Tails Generator

About: I like to computer program. I like soccer.

Intro: Batch File Heads or Tails Generator

Code for a random heads or tails generator.

  1. Open notepad
  2. Copy code below
  3. Save it as ht.bat and click TEXT DOCUMENT and change it to ALL FILES
  4. Click save

@echo off

:top

cls

echo To flip the coin press enter

set /p enter=

set /a a=%random% %% 2+1

if %a% EQU 1 (

echo Heads pause goto top

)else echo Tails pause goto top

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Furniture Contest 2018

      Furniture Contest 2018
    • Audio Contest 2018

      Audio Contest 2018

    2 Discussions

    0
    None
    I_boom5245

    2 years ago

    I have made a new version of this for every one. Copy and paste this code:

    @echo off

    cls

    :loop

    cls

    set /a a = 0

    set /a b = 0

    :game

    cls

    set /p ht= Press enter to flip the coin.

    echo KACHING!!!

    pause

    set /a th = %random% %% 2+1

    if %th% == 1 (

    goto c

    )else if %th% ==2 (

    goto d

    )else goto game

    :c

    cls

    echo HEADS

    echo.

    echo -------------------

    echo.

    set /a a = %a% + 1

    echo Heads: %a%

    echo Tails: %b%

    pause

    goto game

    :d

    cls

    echo TAILS

    echo.

    echo --------------------

    echo.

    set /a b = %b% + 1

    echo Heads: %a%

    echo Tails: %b%

    pause

    goto game