Program a Winner at the Track

by Gareth Powell
(Reprinted from The Australian Apple Review March 1984)

Horse PictureI wrote this article originally for the "Weekend Australian". To those select few who already read that august paper, my apologies. However, there is a consolation prize. The "Weekend Australian" charged $2 for the program listing that appears at the end. You get it free.

Dick Francis writes thrillers about horse racing. And damn good they are too. Francis is writing about something at which he is an expert, for he was a champion steeplechaser for many years. When his books encompass another field apart from horse racing then his research is always meticulous.

In 1981 he wrote "Twice Shy" (still available in paperback from Pan) in which he wrote about the possibility of programming a microcomputer to beat the bookies.

In the book the microcomputer is called a "Grantley", a fictional name. Judging by the segments of pro- grams included it is based on an amalgam of the TRS 80 and the Apple .

There was provision for scoring for any number of horses in each of more than 800 named races, and in an unknown quantity of unnamed races Each race had its own set of weightings and very often its own set of questions."

In "Twice Shy" the program works only too well. Sundry nasty gentlemen with firearms come after our herp only to meet with their come uppance which is only right and proper In a book of this sort

But that is fiction.

Program Listing:-

]

5 CLEAR

10 DIM N$(16),RH(16),B(16),PP(16),BN(16),D116),P(16),W$(16)

20 FOR I = 1 TO 15: READ B(I): NEXT I

30 HOME

40 INVERSE

45 PRINT "***************************************"

50 PRINT "***WEEKEND AUSTRALIAN RACING PROGRAM***"

60 PRINT "***************************************"

65 NORMAL

66 PRINT : PRINT "THE INFORMATION REOUIRED ON 'QUALlFYING RUN' IS PRINTED IN EVERY 'WEEKEND AUSTRALIAN' FOR SATURDAY METROPOLITAN MEETINGS'

67 PRINT : PRINT "A 'OUALIFYING RUN' IS THE LAST RACE RUN BY THE HORSE UNDER SIMILAR CONDITIONS"

70 PRINT: PRINT

80 PRINT " ( I ) 3 YEAR OLDS": PRINT

90 PRINT " (2) WELTER": PRINT

100 PRINT " (3) OPEN": PRINT

110 PRINT " (4) WEIGHT FOR AGE": PRINT

120 PRINT : PRINT : INPUT " ETER RACE TYPE: " ;X$

130 X = VAL (X$) : I F X < I DR X > 4 THEN 30

140 HOME

150 PRINT : INVERSE: HTAB 10: PRINT "**********************"

160 HTAB 10: PRINT "***RACE INFORMATION***"

170 HTAB 10: PRINT "**********************"

175 NORMAL

177 REM

178 REM INPUT PROCEDURE

179 REM

180 PRINT : PRINT : PRINT

190 INPUT "RACE NUMBER : ";X$:RN =VAL (X$) : PRINT

200 INPUT "DATE OF RACE : " ;DT$:PRINT

210 INPUT "NAME OF TRACK : " ;TR$ : PRINT

220 IF X=2 THEN 250

23O INPUT " Dl STANCE : ";X$:Dl = VAL (X$) : PRINT

250 INPUT "NUMBER OF HORSES : " ;X$:N = VAL (X$)

260 IF N > 15 THEN PRINT "<< MAXIMUM HOR8ES = 15>>":GOTO250

265 FOR I=1TON

270 HOME

275 INVERSE

280 PRINT "****************************************"

290 PRINT "RACE ";RN;" AT ";TR$;" ON " ";DT$

295 PRINT : I NVERSE

300 PRINT "****************************************"

305 NORMAL

307 D=DI

310 PRINT

320PRINT: " HORSE NUMBER ";I:PP(I)=I:PRINT

330 INUT "NAME : ";N#(I):PRINT

335IF LEN (N$(I))> 13 THEN PRINT "<< MAX NAME 13 LETTERS >>":GOTO 330

340 INPUT "WEIGHT : ";W:PRINT

350 IF W<50 OR W>70 THEN PRINT "<< WEIGHT BETWEEN 50 AND 70>>":GOTO 340

360 INPUT " BARRIER POSITION : "; P : PRINT

370 IF P < 1 OR P > 15 THEN PRINT "<< ONLY 15 POSITIONS >>: GOTO 360

380 BP=B(P):BN(I)=P

390 INPUT "JOCKEY ALLOWANCE:";JA$:JA=VAL(JA$):PRINT

400 IF JA > 5 THEN PRINT "<< JOCKEY ALLOWANCE MAX = 5 >>":GOTO 360

410 INPUT 'WEIGHT ALLOWANCE : ";WA$:WA=VAL (WA$: PRINT

420 IF WA < - 5 OR WA > 5 THEN PRINT "<< WEIGHT ALLOW14NCE RANGE -5 TO 5 >>": GOTO 410

430 GOSUB 1990

431 TC = SC

441 INPUT "WEIGHT IN QUALlFYlNG RUN : ";W: PRINT

442 INPUT "BEATEN LENGTHS IN OUALIFYING RUN : ": ;BQ: PRINT

443 INPUT "DISTANCE OF OUALIFYING RUN : ";D: PRINT : INPUT "CORRECT (Y/N) :";S$: IF S$ = "N" THEN 270

444 GOSUB 1990

450 EP = (W - BQ * 1.5) - SC

470 RH(I) = TC + EP - BP + JA + WA

480 NEXT I

489 REM

490 REM SORT HANDICAPS

491 REM

500 FOR J = I TO N - 1

510 L = J

520 FOR K = J + 1 T0 N

530 IF RH(L) >RH(K) THEN 550

540 L = K

550 NEXT K

560 TEMP = RH(L) :T1 = PP(L)

570 RH(L) = RH(J) :PP(L) = PP(J)

580 RH(J) = TEMP: PP(J) = T1

590 NEXT J

596 GOSUB 1010

600 HOME

605 INVERSE

610 PRINT "****************************************"

615 NORMAL

620 PRINT " FINAL RESULTS FOR RACE ";RN

623 PRINT

630 PRINT "****************************************"

635 NORMAL

640 PRINT

650 PRINT "POSITION","HORSE","ODDS"

670 PRINT "==============================================="

680 FOR I=1TO N

690 PRINT I,N$(PP(I));SPC( 16 - LEN (N$(PP(I))));W$(I)

700 NEXT I:PRINT

710 PRINT "==============================================="

720 PRINT : INPUT "ANOTHER RACE (Y/N) : ";Y$: IF Y$ ="Y" THEN 5

750 END

1000 DATA 0,0,.25,.25,.5,.5,.5,.5,.5,.75,.75,1,1,1,1

1004 REM

1005 REM ODDS CALCULATION

1006 REM

1010 T = 0

1020 FOR Z=1 TO N

1025 M=RH(1) - RH(Z)

1030 IF M=0 THEN D=1:GOTO1240

1040 IF M< .5 THEN D=.9:GOTO 1240

1050 IF M<1 THEN D=.8: GOTO 1240

1060 IF M<1.5 THEN D=.67:GOTO 1240

1070 IF M<2 THEN D=.57:GOTO 1240

1080 IF M< 2.5 THEN D=.5:GOTO1240

1090 IF M< 3 THEN D=.4:GOTO1240

1100 IF M< 3.5 THEN D=.33:GOTO1240

1110 IF M< 4 THEN D=.25:GOTO1240

1120 IF M< 4.5 THEN D=.2:GOTO1240

1130 IF M< 5 THEN D=.14:GOTO1240

1140 IF M< 5.5 THEN D=.11:GOTO1240

1150 IF M< 6 THEN D=.08:GOTO1240

1160 IF M< 7 THEN D=.06:GOTO1240

1170 IF M< 7.5 THEN D=.05:GOTO1240

1180 IF M< 8 THEN D=.04:GOTO1240

1190 IF M< 8.5 THEN D=.03:GOTO1240

1200 IF M< 9 THEN D=.02:GOTO1240

1210 IF M< 9.5 THEN D=.01:GOTO1240

1220 IF M> 9.5 THEN D=0

1240 D(Z) =D

1245 T=T+D(Z)

1250 NEXT Z

1300 FOR Q=1 TO N

1310 P(Q) =D(Q) /T * 80

1320 P(Q) = INT (P(Q) + .5)

1330 P = P(Q)

1350 IF P> = 75 THEN W$ ="1/3"

1360 IF P< 75 AND P > = 73 THEN W$ = "4/11"

1370 IF P< 73 AND P > = 71 THEN W$ = "2/5"

1380 IF P< 71 AND P > = 68 THEN W$ = "4/9"

1390 IF P< 68 AND P > = 66 THEN W$ = "1/2"

1400 IF P< 66 AND P > = 65 THEN W$ = "8/15"

1410 IF P< 65 AND P > = 63 THEN W$ = "4/7"

1420 IF P< 63 AND P > = 61 THEN W$ = "8/13"

1430 IF P< 61 AND P > = 59 THEN W$ = "4/6"

1440 IF P< 59 AND P > = 57 THEN W$ = "8/11"

1445 IF P< 57 AND P > = 55 THEN W$ = "4/5"

1450 IF P< 55 AND P > = 52 THEN W$ = "9/10"

1455 IF P< 52 AND P > = 49 THEN W$ = "EVENS"

1460 IF P< 49 AND P > = 46 THEN W$ = "10/9"

1470 IF P< 46 AND P > = 44 THEN W$ = "5/4"

1480 IF P< 44 AND P > = 42 THEN W$ = "11/8"

1490 IF P< 42 AND P > = 40 THEN W$ = "6/4"

1500 IF P< 40 AND P > = 38 THEN W$ = "13/8"

1510 IF P< 38 AND P > = 36 THEN W$ = "7/4"

1520 IF P< 36 AND P > = 35 THEN W$ = "15/8"

1530 IF P< 35 AND P > = 33 THEN W$ = "2/1"

1540 IF P< 33 AND P > = 30 THEN W$ = "9/4"

1550 IF P< 30 AND P > = 28 THEN W$ = "5/2"

1560 IF P< 28 AND P > = 26 THEN W$ = "11/4"

1570 IF P< 26 AND P > = 25 THEN W$ = "3/1"

1580 IF P< 25 AND P > = 23 THEN W$ = "13/4"

1590 IF P< 23 AND P > = 22 THEN W$ = "7/2"

1600 IF P< 22 AND P > = 21 THEN W$ = "15/4"

1610 IF P< 21 AND P > = 20 THEN W$ = "4/1"

1620 IF P< 20 AND P > = 18 THEN W$ = "9/2"

1630 IF P< 18 AND P > = 17 THEN W$ = "5/1"

1640 IF P< 17 AND P > = 15 THEN W$ = "11/2"

1650 IF P< 15 AND P > = 14 THEN W$ = "6/1"

1660 IF P< 14 AND P > = 13 THEN W$ = "7/1"

1670 IF P< 13 AND P > = 12 THEN W$ = "15/2"

1680 IF P< 12 AND P > = 11 THEN W$ = "8/1"

1690 IF P< 11 AND P > = 10 THEN W$ = "9/1"

1700 IF P< 10 AND P > = 9 THEN W$ = "10/1"

1710 IF P< 9 AND P > = 8 THEN W$ = "12/1"

1720 IF P< 8 AND P > = 7 THEN W$ = "14/1"

1730 IF P< 7 AND P > = 6 THEN W$ = "16/1"

1740 IF P< 6 AND P > = 5 THEN W$ = "20/1"

1750 IF P< 5 AND P > = 4 THEN W$ = "25/1"

1760 IF P< 4 AND P > = 3 THEN W$ = "30/1"

1770 IF P< 3 AND P > = 2.5 THEN W$ = "40/1"

1780 IF P< 2.5 AND P > = 2 THEN W$ = "50/1"

1790 IF P< 2 AND P > = 1.5 THEN W$ = "60/1"

1800 IF P< 1.5 AND P > = 1 THEN W$ = "100/1"

1810 IF P< 1 THEN W$ = "100/1+"

1820 W$(Q) =W$

1830 NEXT Q

1840 RETURN

1990 REM

1991 REM REGRESSION COEFFICIENTS

1992 REM

2000 IF X=1 THEN SC= -270.94 + W* 8.8034 + D* .07268 - W*D* .00085 - D^ 2 * .000008 - W ^ 2 * .05955

2010 IF X=2 THEN SC = -13 + W * 1.167

2020 IF X = 3 THEN SC = - 3.2 + W * 1.156 - D * .009 + D ^ 2 * .000002

2030 IF X = 4 THEN SC = 252.14 - W * 9.688 + D * .003 + W ^ 2 * .1069

2040 RETURN

]

Is it possible to forecast the winners of horse races on a microcomputer in real life? The answer a firm and unequivocal 'maybe'

In the '60s a betting syndicate called "The Legal Eagles', led by Don Scott and including among its members Clive Evatt Jr, undoubtedly gave Australia's bookies a run for their money. They used a system which was based on empirical experience, intelligent observation and mathematical probability.

At one stage the syndicate was employing a staff of 12 to keep form cards, film races and place bets.

In 1975 Don Scott stopped being a professional punter and wrote a book called "Winning, An Objective Guide to Successful Punting". The introduction was provided by Bill Waterhouse and "Winning" is possibly still the best book on horse race betting written in Australia.

If the basic hypotheses advanced in this book are true then, in theory, a microcomputer could take the place of that staff of 12 and maintain records which would be a winning computer system. became interested in this possibility of a microcomputer based betting system when Graeme Philipson, a computer industry commentator with "The Yankee Group" - an organisation that tells you more about computers than you want to know - lent me a remarkable document.

It was a thesis on the profitability of horse race gambling by Scott Williams, BEc, Dip Rur Acc, who had written it as a "dissertation submitted in partial fulfilment of the requirements for the degree of Master of Economics of the University of New England".

The thesis starts off by disarmingly stating that among its several aims it should let the author "lead a life of ease on the winnings from the implementation of the various systems" .

When the thesis was written, the year was 1975, ancient history in microcomputer terms, and the programs were designed for implementation on the University of New England's ICL 1904A computer on strictly rationed time.

This was not the ideal set up but, even so, Scott Williams attempted to answer the question: "Can analytical techniques, typical of those we would expect to use in business management, be used to formulate strategies that can be used for betting on Australian horse races so as to achieve profits comparable with other forms of investment?"

And the quite startling conclusion that he came to at the end of his thesis was that "race gambling, in even a reasonably unsophisticated manner, is potentially quite considerably more profitable than other forms of common investment'.

Being "reasonably unsophisticated" I was entranced at having found a means by which I could cease working for a living and become a rambling, gambling man through the virtues of a system run on a microcomputer.

An Irish mathematical genius had once explained to me that the chances of winning the Irish Sweep were almost precisely the same whether you bought a ticket or not. But this was different. This was using modern technology to break the bank. The phrase "being reasonably unsophisticated" takes on a new meaning when I tell you that up until that time I had never bet on a horse in my life.

I therefore went into a short-lived betting partnership with Graeme "Phar Lap" Philipson in which we attempted to bring the bookmaking establishment of Australia to its knees through an initial gambling investment of $100. We did not succeed. The program that we used was sold in the United States under the misleading title of "Win at the Races". It used a mathematical statistical formula called Multiple Regression Analysis Factor for each major racetrack in Australia.

We also modified the program to suit Australian conditions. We were cleaned out on the first day's racing.

There was a good and proper reason for this. We insisted on placing a bet on every race. There's no racing system in existence which will let you place a bet on every race - and win.

But to get a list out of the program meant that Phar Lap and I worked like maniacs from the early dawn of Saturday morning until race time, punching in the information that was required. Having gone to all that effort we thought the least we could do was to place a small bet to see what happened. And thus our $100 went down the glug hole.

I tried the system once again in Hong Kong - and it didn't work there either. Again for the same reason. Having expended that much effort in entering in the information, I wanted a bet in order to at least have a chance of seeing a return on effort invested .

I bet $HK1000 and won $HK620. A net loss of $HK380. As a system this leaves something to be desired. If before that time I had read Don Scott I would have realised that the situation was not a hopeful one. He says: "Final times and sectional times are constantly being fed into dozens of computers around the nation. The computers are given every horse from first to last that are raced at a meeting and are solemnly asked to declare what time each horse ran and what time each horse should have run.

"The following Saturday they have to answer for all of the horses how fast they are going to gallop carrying separate weights over each separate distance that day. And computers have to answer these questions rain hail or shine. No wonder they often break down under the strain."

Since that time I have learnt a lot about computer forecasting of races. Although I have totally given up betting - once bitten, twice miserly- I have tried to read every skerrick of information about the subject so that I can now tell you, with authority, that Babbage tried to invent the first computer so that his inamorata Ada Lovelace, could win at the races. I have also talked to several professional punters who use computers to direct them in their betting. (It is of interest that most of them seem to have names coined by Damon Runyon.)

From this I have come to some conclusions: A microcomputer can help you to achieve better results in betting on horse races. If you insist on betting on every race you will lose.

Certain types of race are difficult. if not impossible, for the computer to analyse. You should not bet on these. Examples are races beyond 2000m, races held in wet conditions, races which are not held at major metropolitan tracks, races which have more than 12 runners, races which have less than four runners and races in which one or more of the runners have a previous form.

The amount of time and effort that is required to enter all of the necessary information means that, unless you start with a substantial bankroll, you are working for about 27c an hour. Having said that, I repeat that I believe it is possible to be more successful at the races using a microcomputer than otherwise.

The program we have produced uses some reasonably sophisticated computing techniques incorporating Multiple Regression Analysis. The program will at least let you lose scientifically, if not make a fortune in the first week.

The program has been put together by a troika of talents. The three people concerned are Ethan Dorfmann of Hitachi, who used his considerable programming skills - once the concept had been explained to him. Second member of the team was Graeme "Phar Lap" Philipson who is a computer industry analyst for "The Yankee Group" and is also, as his nickname suggests, a man who has spent considerable time and effort following the horses.

And lastly I plead guilty to having worked out the concept of the program and having spent a large amount of time, but no money, in putting the various components together and checking the results.

When we completed the first draft of the program, we found that, as it stood, it had two flaws. The first was that we had gone too far in showing off our programming skills. Nothing exceeds like excess.

After the program had shown the winners in list form it produced a graphic representation on the screen of the horses at the winning post with he first three horses named and in their correct relative position with all the jockeys in their right colours.

Which is pretty spectacular. But doesn't help you to win at the races. It also involves typing in the colours that each jockey is going to wear in each race and this is an added burden which may put you off using the program to its fullest advantage.

The second problem was that we had made no allowance for the interested punter to use experience and judgement. The result was a cold sterile program that acted as if it knew it all. Computers don't know it all. They just think they do.

We decided that there were two factors that could be optionally entered by the punter on the basis of experience and judgement. The first factor is a jockey allowance, the second a weight allowance. We'll come to these in a moment. Note that these value judgements are not absolutely necessary. We just felt that you might like to have some control over your own destiny.

Once you start the program the title page appears you are invited to enter the type of race involved:

1. Three year olds

2. Welter

3. Open

4. Weight for age

Having entered the type of race you are working on you are confronted with another screen asking for race information.

1. Date of race

2. Name of track

3. Race number

4. Distance

5. Number of horses

The next screen confirms the information you have entered with a listing across the top showing which race it is, where and at what date. You then have to enter the following information.

1. Horse number

2. Horse name

3. Weight carried

4. Position at barrier

5. Weight allowance

(If you press RETURN at this point the value given will automatically zero. However, if you fancy yourself in making value judgements regarding horses in a particular race, go for your life. What you are then doing is effectively handicapping the horses. This requires judgement and expertise and we have a sneaky feeling that the end result is going to favour the punter who.ignores this and just presses return. Time will tell.)

6. Jockey allowance

(Again, you can ignore this because it is another value judgement. An apprentice first time up might justifiably be given a rating of -1) One of the seasons top twenty jockeys, on the other hand, might be given an allowance of +1. Figures in excess of this either was will skew the results to such an extent that they become meaningless.

Once you have entered these vital statistics you will see almost immediately on your screen a prediction of the results.

From left to right will be given predicted position, name of horse, barrier drawn and expected odds. In this the first of a series we have checked out our own Multiple Regression Factors and entered them in as constants.

Which means that this program is not designed to update itself as you go along by adjusting the MRA factor after the results of each race have been obtained and entered in comparison with the prediction.

We can and will do this at a later date but the amount of work that you, the punter, will have to do then will increase enormously. In order to arrive at a satisfactory weighting you will need to enter the historical record of each horse.

This is a time consuming and expensive business. Either you spend the wee hours before each race day frantically going through the form books and entering the last five significant races with all relevant details (barrier position, weight carried, race track, race length, rating of jockey time at the Leger, completed race time) or you retain all of this information on a 10 Megabyte hard disk so that you eventually build up a file of information on every galloper in Australia.

Historical record

We are following the second method after this program has been running for eight weeks we may issue new weightings. You will easily be able to enter these into the program if significant changes have occured. We are also working on a program that can download through the telephone current information from one of the news services so that the keying in of the information will not be necessary. We will keep you informed.

The most important information that this current program will give you is "forecast odds". It is here that the intelligent and patient punter will make money.

If the projected odds are in line with those being quoted then it is possible that the other forecasters are using a similar method to ours. (Laughable though you may find this we found we were uncannily close on three trial runs). What you will be looking for is an "overlay". That is where the program says that the winner's odds should be, say, 4/1 and the odds predicted as shown in your newspaper are 12/1. This is a profit potential situation.

When the results come up on your screen or printer if you have one look first for the "overlays" and mark them for closer study. Reject any race where the difference in odds between the first three horses is insignificant. The bigger the spread, the bigger your chances of success.

1. Do not bet on a race where there are four runners or less.

2. Do not bet on a race where there are more than fifteen runners.

3. Do not bet on anything except the major metropolitan meetings.

4. Do not bet on a race where one or more of the horses has no record whatsoever.

5. Do not bet if the track is wet and heavy.

6. Do not bet unless you can expect an "overlay" on the odds.

7. Do not bet if the predicted positions of the first three horses is close. The level of acceptable closeness is a value judgement you can make.

8. Do not bet unless you can well afford the money. The chances of you making a steady return on your money are not high unless you have a comfortable bankroll and you are a disciplined and motivated punter.

9. Do not bet. Ethan Dorfmann and I do not bet. Phar Lap Philipson does. Ethan Dorfmann and I drive new cars. Phar Lap Philipson has a Morris Minor which has lurched past its majority and is a static monument to English engineering.

The program as it is written has been tested and works. But we can make no guarantees as to whether you will make a fortune beating the bookies.

May the force be with you.


Return To Article Index / Return To Index

@