loading

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

<p>I have made a new version of this for every one. Copy and paste this code:</p><p>@echo off</p><p>cls</p><p>:loop</p><p>cls</p><p>set /a a = 0</p><p>set /a b = 0</p><p>:game</p><p>cls</p><p>set /p ht= Press enter to flip the coin.</p><p>echo KACHING!!!</p><p>pause</p><p>set /a th = %random% %% 2+1</p><p>if %th% == 1 (</p><p>goto c</p><p>)else if %th% ==2 (</p><p>goto d</p><p>)else goto game</p><p>:c</p><p>cls</p><p>echo HEADS</p><p>echo.</p><p>echo -------------------</p><p>echo.</p><p>set /a a = %a% + 1</p><p>echo Heads: %a%</p><p>echo Tails: %b%</p><p>pause </p><p>goto game</p><p>:d</p><p>cls</p><p>echo TAILS</p><p>echo.</p><p>echo --------------------</p><p>echo.</p><p>set /a b = %b% + 1</p><p>echo Heads: %a%</p><p>echo Tails: %b%</p><p>pause </p><p>goto game</p>
<p>Nice way to make a decision.</p>

About This Instructable

400views

3favorites

Bio: I like to computer program. I like soccer.
More by I_boom5245:How to add Chrome Extensions Batch File Matrix + Explanation Batch File Matrix 
Add instructable to: