forked from bmrf/standalone_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lottery.bat
35 lines (28 loc) · 938 Bytes
/
lottery.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
:: Loops through a comparison of %RANDOM% and any time %RANDOM% is less than 3, adds a point to the "tick counter"
:: At STOPTIME the script terminates and displays how many tick hits there were (how many times %RANDOM% was less than 3)
:: VARIABLES
set LOG=%userprofile%\desktop\lottery.log
set STOPTIME=14:55
:: PREP
cls
@echo off
set LAUNCH_TIME=%TIME%
echo %LAUNCH_TIME% Contest start (%username%)
setlocal EnableDelayedExpansion
:: TICK LOOP
:loop
if %time:~0,5% equ %STOPTIME% goto :done
set /a "ITERATIONS=%ITERATIONS%+1"
if %RANDOM% LSS 3 (
color 0a
set /a "HITS=%HITS%+1"
echo %TIME% TICK HIT ^(!HITS! hits, %ITERATIONS% iterations^)
)
goto :loop
:: COMPLETION
:done
echo %TIME% ^! Time limit reached
echo TOTAL ITERATIONS: %ITERATIONS%
echo TOTAL HITS: %HITS%
echo USER: %USERNAME% LAUNCH: %LAUNCH_TIME% FINISH: %TIME% ITERATIONS: %ITERATIONS% HITS: %HITS%>>%LOG%
pause