March 20th, 2014 at 3:22:00 PM
permalink

Hi

I'm working on a virtual racing app and am struggling a bit with the underlying maths (alight struggling a lot!)

Basically the scenario is that I would have 6 horses with different odds (fair odds) and corresponding probabilities of winning. These could be

Horse 1: 40%

Horse 2: 25%

Horse 3: 15%

Horse 4: 10%

Horse 5: 7%

Horse 6: 3%

Total 100%

Now I want to animate these horses running across the screen

Lets say that a horse needs 1000 moves to win, and the race is run by picking a horse on each "spin" to determine which ones moves each time

So the probability that Horse 1 gets 1000 moves before any of the others gets 1000 moves is 40%

The probability that Horse 2 gets 1000 moves before any of the others gets 1000 moves is 25%

etc

So what probability to I need to give to each horse on a single spin to achieve this

Thanks for reading :)

I'm working on a virtual racing app and am struggling a bit with the underlying maths (alight struggling a lot!)

Basically the scenario is that I would have 6 horses with different odds (fair odds) and corresponding probabilities of winning. These could be

Horse 1: 40%

Horse 2: 25%

Horse 3: 15%

Horse 4: 10%

Horse 5: 7%

Horse 6: 3%

Total 100%

Now I want to animate these horses running across the screen

Lets say that a horse needs 1000 moves to win, and the race is run by picking a horse on each "spin" to determine which ones moves each time

So the probability that Horse 1 gets 1000 moves before any of the others gets 1000 moves is 40%

The probability that Horse 2 gets 1000 moves before any of the others gets 1000 moves is 25%

etc

So what probability to I need to give to each horse on a single spin to achieve this

Thanks for reading :)

March 23rd, 2014 at 6:30:59 AM
permalink

This is a cool problem. I don't think I can come up with a way to solve the problem the way you described. Especially on the computing budget you need.

However, I think I might be ale to come up with an alternative method (based on exponential distributions). Do people also need to be able to bet on place and show? I know my method will work if place and show don't matter, but if those do, then I need to look at how to augment my method.

However, I think I might be ale to come up with an alternative method (based on exponential distributions). Do people also need to be able to bet on place and show? I know my method will work if place and show don't matter, but if those do, then I need to look at how to augment my method.

March 23rd, 2014 at 9:21:08 AM
permalink

I don't think there's an easy straightforward mathematical way of doing it, since there are 10

Doing a Monte Carlo method and fiddling around with the numbers, if I start with "step probabilities" of 17.1%, 16.9%, 16.7%, 16.6%, 16.45%, and 16.25%, I get win probabilities close to what you want. (A run of 100,000 races gets 39.9%, 25.0%, 14.5%, 10.6%, 6.7%, and 3.3%.)

^{18}different states (each horse can have from 0 to 999 steps).Doing a Monte Carlo method and fiddling around with the numbers, if I start with "step probabilities" of 17.1%, 16.9%, 16.7%, 16.6%, 16.45%, and 16.25%, I get win probabilities close to what you want. (A run of 100,000 races gets 39.9%, 25.0%, 14.5%, 10.6%, 6.7%, and 3.3%.)

March 23rd, 2014 at 1:59:51 PM
permalink

@endermike - thanks for the reply

No its not essential as their would be no betting on anything other than the winner - it would only be useful for better realism of the game

No its not essential as their would be no betting on anything other than the winner - it would only be useful for better realism of the game

March 23rd, 2014 at 2:05:20 PM
permalink

@ThatDonGuy

Thnaks - yes it seems very complicated yet clearly someone must have solved this as sportsbooks to take real money bets on virtual racing so if the chances of winning dont resememble their odds (or are less than their odds for a bookmaker margin) then someone would have made a lot of money there

I guess its possible that they dont do it the way I describe though in terms of probability of a "move" but just use the probabilities of winning to pick a winner, second, third etc and then just have a series of fake animation sequences that lead to that result

The MonteCarlo method sounds good- is there a tool I could use for running tests like this if I change my mind of the initial probabilities I want?

Thnaks - yes it seems very complicated yet clearly someone must have solved this as sportsbooks to take real money bets on virtual racing so if the chances of winning dont resememble their odds (or are less than their odds for a bookmaker margin) then someone would have made a lot of money there

I guess its possible that they dont do it the way I describe though in terms of probability of a "move" but just use the probabilities of winning to pick a winner, second, third etc and then just have a series of fake animation sequences that lead to that result

The MonteCarlo method sounds good- is there a tool I could use for running tests like this if I change my mind of the initial probabilities I want?

March 23rd, 2014 at 2:16:39 PM
permalink

Yeah, My initial instinct was to suggest a method similar to Don's but I thought the computational requirements would be too much for a mobile app (I may be wrong on that but I am in no position to judge, I can tell you it would not be cheap on a laptop and I'm assuming that would mean it would too much on a phone). I just looked at your post again, please confirm this is for a phone app? Could it be run on a server and then pass the data to the app?

March 23rd, 2014 at 3:19:53 PM
permalink

Ahh ok its not as complex as this

I dont need to calculate this every time, but just a few times in advance so for the example probabilities above, and then maybe another 4-5 sets of probabilities, and then work out the move probabilities 1 time, and record them.

Then depending on which of win probability profiles I pick I will know the move probabilities.

The app will run on desktop mainly but I think Ive shown thats not really relevant anyway

I dont need to calculate this every time, but just a few times in advance so for the example probabilities above, and then maybe another 4-5 sets of probabilities, and then work out the move probabilities 1 time, and record them.

Then depending on which of win probability profiles I pick I will know the move probabilities.

The app will run on desktop mainly but I think Ive shown thats not really relevant anyway

March 23rd, 2014 at 4:52:25 PM
permalink

Quote:antonypThnaks - yes it seems very complicated yet clearly someone must have solved this as sportsbooks to take real money bets on virtual racing so if the chances of winning dont resememble their odds (or are less than their odds for a bookmaker margin) then someone would have made a lot of money there

Nothing reaches the floor until it is thoroughly tested.

I don't think a sportsbook is allowed to take a bet on a "virtual" race. However, nothing stops the casino from having a separate machine that lets a player make a bet on a horse and then show a race, although the way those usually work is, the machine knows the winner in advance, (somewhat) randomly assigns odds to the horses, and then shows the race. A machine like Sigma Derby probably works more like what you describe - the horses move one at a time, and the odds are based on how likely a horse is to move.

Quote:The MonteCarlo method sounds good- is there a tool I could use for running tests like this if I change my mind of the initial probabilities I want?

Not that I know of - I wrote mine from scratch.

March 23rd, 2014 at 5:00:06 PM
permalink

Maybe you can start solving the problem with only 2 horses, and then find out how complicated the solution is. It is much likely to get more complex with many horses :)

March 23rd, 2014 at 5:14:14 PM
permalink

I would take Don's approach in reverse. I would set probabilities of moving semi-randomly and then simulate the race many times. I would then take those simulation results to set the odds (with appropriate vig factored in).

If you need to do it the other way (set odds then find move probs), I think you need to do a ton of offline calculation, and then set in some preset races (move probs and odds but not the outcome).

If you need to do it the other way (set odds then find move probs), I think you need to do a ton of offline calculation, and then set in some preset races (move probs and odds but not the outcome).