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 :)
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.
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%.)
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
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?
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
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.
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).
Quote: endermikeI 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.
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:Quote: ThatDonGuyActually, 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.)
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
Quote: endermikeSorry 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.
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
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