antonyp
antonyp
  • Threads: 1
  • Posts: 5
Joined: Mar 20, 2014
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 :)
endermike
endermike
  • Threads: 7
  • Posts: 584
Joined: Dec 10, 2013
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.
ThatDonGuy
ThatDonGuy
  • Threads: 117
  • Posts: 6268
Joined: Jun 22, 2011
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 1018 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%.)
antonyp
antonyp
  • Threads: 1
  • Posts: 5
Joined: Mar 20, 2014
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
antonyp
antonyp
  • Threads: 1
  • Posts: 5
Joined: Mar 20, 2014
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?
endermike
endermike
  • Threads: 7
  • Posts: 584
Joined: Dec 10, 2013
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?
antonyp
antonyp
  • Threads: 1
  • Posts: 5
Joined: Mar 20, 2014
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
ThatDonGuy
ThatDonGuy
  • Threads: 117
  • Posts: 6268
Joined: Jun 22, 2011
March 23rd, 2014 at 4:52:25 PM permalink
Quote: antonyp

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


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.
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
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 :)
endermike
endermike
  • Threads: 7
  • Posts: 584
Joined: Dec 10, 2013
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).
ThatDonGuy
ThatDonGuy
  • Threads: 117
  • Posts: 6268
Joined: Jun 22, 2011
March 23rd, 2014 at 6:19:23 PM permalink
Quote: endermike

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).


Actually, that's what I did - I assigned a probability to each horse of that horse being the one to move in a particular "step" (only one horse at a time moves - otherwise you run the risk of dead heats), ran 100,000 races, then tweaked the numbers, ran another 100,000 races, and kept tweaking until the numbers came close to what was requested. (At first, the 40% horse won all 100,000 races.)

Once you know the odds of a particular horse winning, you can have the machine set all of the odds so that the house advantage is what you want.

There are two other things I suggest.
First, the five probabilities of moving/winning have to be assigned to the horses randomly. If #1 is always the horse with the 40% chance of winning, and its odds are 2-1, then it's a player's advantage game.
Second, have different sets of winning probabilities (don't always use 40-25-15-10-7-3; maybe have one that's more like 32-24-18-12-9-5), and choose one randomly for each race.
endermike
endermike
  • Threads: 7
  • Posts: 584
Joined: Dec 10, 2013
March 23rd, 2014 at 6:39:36 PM permalink
Quote: ThatDonGuy

Actually, that's what I did - I assigned a probability to each horse of that horse being the one to move in a particular "step" (only one horse at a time moves - otherwise you run the risk of dead heats), ran 100,000 races, then tweaked the numbers, ran another 100,000 races, and kept tweaking until the numbers came close to what was requested. (At first, the 40% horse won all 100,000 races.)

Sorry I wasn't clear. It seemed to me that antonyp wanted to set probs of winning and then find step probs. I think anton should abandon that approach unless it is critical and take the following basic plan:

1) Generate step probs (finding some good distributions would be a good project)
2) Simulate races and record finish probs
3) Set payouts
4) List payouts
5) Accept bets
6) Simulate the race one more time visibly for the bettors
7) Record results and payout bets
ThatDonGuy
ThatDonGuy
  • Threads: 117
  • Posts: 6268
Joined: Jun 22, 2011
March 23rd, 2014 at 10:34:06 PM permalink
Quote: endermike

Sorry I wasn't clear. It seemed to me that antonyp wanted to set probs of winning and then find step probs.


He did - and as I explained to him, this is pretty much impossible in a short length of time as far as I know.

It seems to me that the two of you are asking for the same thing, but in reverse directions; antonyp wants to know the step probabilities that generate particular win probabilities, while you suggest starting out with particular step probabilities and using whatever win probabilities are generated. I suggest that his method can be achieved, at least near enough for him, by using your method and then tweaking the step probabilities based on the win probabilities.
antonyp
antonyp
  • Threads: 1
  • Posts: 5
Joined: Mar 20, 2014
March 24th, 2014 at 1:39:25 AM permalink
Thanks guys - very helpful

I think you are both telling me the same thing :)

I need to start with the move probability (and Don has already shown me how close together they need to be) and then this will give me win probabilities from which I can set odds. I then adjust and repeat as much as I need to get a some ranges of win odds that I like.

I understand the logic and the approach now thanks very much for your help
hernandezaderly
hernandezaderly
  • Threads: 0
  • Posts: 1
Joined: May 9, 2014
May 15th, 2014 at 12:06:08 AM permalink
You will not get any exact formula for calculation of this problem .You can try using some handicapping systems that might help you to get the exact information .View more here for handicapping systems at .
tringlomane
tringlomane
  • Threads: 8
  • Posts: 6281
Joined: Aug 25, 2012
May 15th, 2014 at 2:02:56 AM permalink
Quote: ThatDonGuy

(At first, the 40% horse won all 100,000 races.)



Haha...1000 steps adds up a lot, eh?

Interesting problem though, thanks for taking the time out to set up a Monte Carlo for it.

And oops, this was an old thread...but I was in Tunica at the time it was created...that's my excuse at least. :P
  • Jump to: