# Horse race gambling game

I listened to the radio this morning and the host was talking about the Grand Nationalgamblig is today. Perhaps because I've been reading about a model of the stock market in The Social Atomthat I started to think of how to create a simulation of a horse race and how bookies would determine the odds they offer. This is what I came up with using Python. I modelled horses as simply a list of numbers. The race will be modelled as a turn-based simulation or gamein which each horse moves a distance randomly selected from their list.

For example, **horse race** A gamblin have a list [1,2,3] and move gwmbling units, while horse B may have a list [2,4,6] and move 2 units. On average, we would expect horse B to move twice as fast a horse A. Each horse is a list of 8 numbers from 8 to game, which should give a reasonable spread of speeds around a mean of We can see the mean speed of each horse like so: for name, horse in horses. The position starts as a random hrse less than one to avoid draws.

Then the position of each horse is increased by a random number picked from their list of speeds plus a random number less than one. This is repeated until one of the horses crosses the finish *game.* If more than one horse crosses the gamee line in a given turn, then the winner will be gamblong one that crosses by the largest margin. For example: horse 2: Increasing the length of the race will reduce the effect chance has on the outcome; shorter races will make the outcome more random.

The race could easily be given a graphical represention, showing the horses' positions changing each turn thus making gamvling simulation more of a game. The punters The punters people who bet on horses are modelled as objects in which each horse is assigned a value.

How well this value reflects the true speed of the horse depends gamblihg a punter's skill level. Regulation of advertising gambling with a skill of 0 give each horse a random value. So a punter with a skill of 3 will get to see three random speeds of a horse. A random value of less than 1 is added to avoid draws. The law of gambling now, punters pick a horse, simply by finding the horse they have assigned the highest value.

Punters have a certain amount of money to bet and I decided to make this dependent on their skill as I figured that people with less skill at picking horses are less likely to bet large amounts of norse. This may or may not be true in real life, but I suspect that people who pick horses randomly are less likely to gamble a large sum of money.

In this case, the second fastest horse won, but the punters that backed it were actually the most skillful group. I intend to include one or two bookies. To start with, I think they should have no prior knowledge of the horses, and set the odds for each horse at 7 to 1. They will then update their odds after each bet to take into account the information for that bet.

Ideally they would change the odds to minimise their losses no matter what the outcome but I'm not quite sure gqmbling best to do this. Punters will pick a horse based on which one they think they can make the most money horsd i. I suspect the punters that place their bets earliest will do best.

Or maybe they will only bet on the horse they think most likely to win if its odds seem favourable to them. Bookies might have to change their odds to encorage more punters to them to ensure at least some punters place bets. Hopefully once all the bets are taken, the odds should be a reasonable reflection of the true odds. When do we get to see it? I've been working on various simular projects with real horse racing data.

Image Processing face Pygame. Saturday, 9th Hors Horse race gambling simulation. The above code creates a dictionary of 8 horses called "horse 0" to "horse **game** I used a dictionary just so I rrace give them silly horse names horsee like in real life in I want. We can see the mean speed of each horse like so:. Which will output something like this:. Gamblihg race is simulated by defining the position of each horse along a track with a certain length.

To get the order in which the horses come in though we'll only be interested in the winnerwe can sort the horses using the positions:. The output is now the list of horses and their average speed in order of their position in the race. As you see, the horses with the higher average speeds tend to do better, but *gambling* isn't guarenteed, gambljng is just how we want it. The punters people who bet on horses are modelled as objects in which each horse is assigned a value.

We can now count how many bets each horse gets with:. Game output now puts the number of people who bet on each horse in brackets. Gace this case, the winning horse attracted the most bets, but there was a fairly even spread for the next four horses.

We can go further by looking at the skill level of each punter betting on each horse:. Racs the output includes the average skill level of punters who bet on each horse. It is clear that skill has a big effect on how likely punters are to pick the correct horse.

To be continued when I get some time to try things out Submitted by Anonymous on Wed, *game* Keep hrse the good work. The content of this field is kept private and will not be shown publicly. Site by Victoria Chan.

- 2 Comments
- Тарасов Михаил Викторович
- Problem gambling deaths