MiickyWhat are we talking about

I am a true Formula 1 fan. I've been following races since the age of eight, in the working calendar all the dates of the Grand Prix are listed, and through RSS I read several thematic sites. At one of them annually held a competition of forecasts. The rules are simple - before each Grand Prix you need to predict the top ten riders at the finish. Following the results, two tables are compared - ten pilots indicated by you in the forecast and ten best pilots at the end of the race. Predicting the top ten is difficult because of unforeseen circumstances in the form of car fires, accidents or breakdowns. Because I answered one simple question - who earns the most bets? Of course bookmakers. So what are the chances of winning the competition, if you put on forecasts, for example, the British office of
William Hill ?
The rules of the contest are simple. Pilots who finish outside the top ten are not counted. If the pilot finished at the place you indicated in the forecast, you get 25 points, if you make a mistake on one position - 18 points, on two - 15 points, on three - 12 points, on four - 10 points, on five - 8 points , on six - 6 points, on seven - 4 points, on eight - 2 points and on nine - 1 point. (Riders get the same points for finishing the race). Points for each position are summarized. In determining the winner at the end of the season, the results of the five best forecasts are taken into account.
Getting Started
First, I found the
forecast of the bookmakers before the race, as well as the
results of the races and put them in one
table.I had no desire to read the results for all 20 Grand Prix, because it was decided to write a small script. But I programmed the last time at school, and using Google Developers
documentation and their platform, I managed to sketch a working script for quite a long period of time, recalling the extraterrestrial feeling of a working script after thirty minutes of searching for an error.
')
* Sample Australian Grand Prix 2012
No | Race | Forecast | Points |
one | Button | Vettel | 12 |
2 | Vettel | Hamilton | 18 |
3 | Hamilton | Webber | 18 |
four | Webber | Button | 18 |
five | Alonso | Alonso | 25 |
6 | Kobayashi | Rosberg | 0 |
7 | Raikkonen | Raikkonen | 25 |
eight | Perez | Schumacher | 0 |
9 | Riccardo | Grosjean | 0 |
ten | di Resta | Weight | 0 |
Example code for scoring, sharpened by this table
function points() { var sheet = SpreadsheetApp.getActiveSheet();
After calculating the sum of points for each stage, using the LARGE function, I chose the five best results.
Top fiveThe Grand Prix | Total points |
India | 156 |
USA | 155 |
Canada | 118 |
Singapore | 117 |
Australia | 116 |
Amount | 662 |
First conclusion
Despite a good overall result in all races (2064 points), my top five (662 points) did not manage to compete with the
top three winners (789-767 points), but the result was better than my own, built on “flair”.
To not give up
I did not stop at that and made a total of seven different forecast functions.
- Above described - the forecast was calculated by the rates of bookmakers for a separate stage;
- At bookmaker rates for winning the championship, before the start of the season;
- The bets of my pet cat "MatzYka", which walked on the keyboard - a random dozen riders, one for all stages;

- Random dozen riders for each stage is different;
- The results of the first practice;
- The results of the second practice;
- The results of the third practice.
All results in one tablePayment | Score 5 best results |
Bookmakers stages | 662 |
Champion Bookmakers | 640 |
Random-one (Matyk) | 569 |
Random-all | 542 |
First practice | 596 |
Second practice | 712 |
Third practice | 622 |
findings
In the final part of the article there should be a conclusion, and I have a problem with this :) Before starting work, I thought that the forecast would be, if not the best, then at least close to it. But another was confirmed - to show a good result at the expense of only a simple theory of probability does not work, you need to modify the existing algorithm with other variables. On the other hand, I amused my own, who forgot what programming is, the brain, decided an interesting task for me, and maybe for you, a task, and got a little bit of experience.
Post Scriptum
On github, the code was not flooded, since it is sharpened by a table.
The table and the script are available for viewing, to work with them, make a copy of yourself in Google Disk, to start the counting - menu "Gadgets".
If the reader has any ideas about how else to calculate the forecast - write to me, I will be happy to hear them.