Please excuse any mistakes, this is my first post! Recently I was bored and was trying to make a batch script clone of an arcade game I once saw: http://antikrish.com/2013/01/28/whittakers-ascot-gold-cup-horse-racing-arcade-game/
Rules
I couldn’t remember the rules and wanted it to be fair so made my own.
Problem
I ran the game and everything seemed good! Except after a while I noticed Horse 1 almost never seemed to win. Now this could be explained with probability but I wanted to check, so I altered my code to keep track of the results over time and saw that the higher numbered horses were winning consistently more often!
I’ve uploaded a graph (https://i.sstatic.net/gSzqV.png) showing the results of the winners of three sets of 1000 races, where draws are allowed (and count as a win for all that finished). Now this behaviour isn’t necessarily a bad thing and means odds can be attached to each horse, however I am confused as to why it’s happening.
Reasons
In my mind there are three reasons for why this behaviour may be occurring:
So, can anyone enlighten me as to why this may be happening?
Thanks in advance!
Here is the code if helpful:
@ECHO OFF
COLOR 0B
setlocal EnableDelayedExpansion
set total = 0
set totalscore[0]=0
set totalscore[1]=0
set totalscore[2]=0
set totalscore[3]=0
set totalscore[4]=0
set totalscore[5]=0
set totalscore[6]=0
:START
set /a total = total + 1
set score[0]=0
set score[1]=0
set score[2]=0
set score[3]=0
set score[4]=0
set score[5]=0
set score[6]=0
set winner=0
:LOOP
cls
echo Race Number: %total%
for /l %%n in (1,1,6) do (
set /a num=!random! %%%%n + 1
IF !num! == %%n set /a score[%%n]=!score[%%n]! + !num!
<NUL set /p=%%n:
for /l %%x in (1, 1, !score[%%n]!) do <NUL set /p=^|
set /a sum=60 - !score[%%n]!
for /l %%x in (1, 1, !sum!) do <NUL set /p=_
echo F
)
for /l %%n in (1,1,6) do (
if !score[%%n]! == 60 (
echo winner: %%n
set /a totalscore[%%n]=!totalscore[%%n]! + 1
set winner=1
)
)
echo.
echo Previous Results
for /l %%n in (1,1,6) do (
echo %%n: !totalscore[%%n]!
)
if %winner%==1 GOTO END
timeout /t 0 /nobreak > NUL
GOTO LOOP
:END
echo.
pause
GOTO START
EDIT I think its a probability quirk, as Horse 6 has a chance to finish after 10 turns, where all other horses physically can't. This adds up for each horse, reducing the horses below it's chances (i.e horse 1 will only win if the other's all under perform).
Thanks for the responses :)
The issue comes down to probability!
If we simplfy the game down to 6 moves:
Horse 1 will finish in 6 moves, however horse 6 has 5 attempts to beat it at 1/6 chance each try.
The odds of horse 6 NOT finishing = (5/6)^5 = 0.40 Therefore the odds of horse 6 finishing in 5 moves or less is 0.6
If we do this for each of the horses, poor horse 1 never stood a chance!