How to Construct the Input Bet String
2019-09-28 11:39 Dorisoy 阅读(310) 评论(0) 编辑 收藏 举报The purpose of this section is to describe the format of the string which will submitted to the Python bet processor strats.py. This string is a series of lines that are Python variable declarative statements. There are a few things that readers not very with familiar with Python should know about:
- # starts a comment, so anything after and including # will be ignored, so lines starting with # can help make the intent of the declaration clear
- Blank lines are ignored. This may help the readability of the string when printed/debugged
- self. included in a variable declaration refers to the variable as a member of the class where it is declared. In our case it will be in a
strats.Bet
class object.
The rest of this manual will describe what variable to declare and what it means. These variables (attributes) will be introduced in the preferred order of declaration. Generally speaking, there is a default value for each variable, except for strats.Bet.bet_type
and (currently) strats.Bet.nraces
which must be specified.
[1] | I would suggest that we let strats.py define strats.Bet.nraces from strats.Bet.bet_type . |
Type of Bet Pool [Mandatory]
This is one of Quinella, Exacta, Trifecta, Pick 4, Pick 6, Quaddie, Superfecta. An example of this part of the string might be:
self.bet_type = "Quaddie"
Number of Races [Mandatory?]
This attribute is the number of races for which information is required. It is
- 1 for Quinella, Exacta, Trifecta, Pick 4, and Pick 6
- 4 for Quaddie
- 6 for Superfecta
An example part of the string would be for the Quaddie:
self.nraces = 4
[2] | strats.Bet.nraces should possibly removed from user input: but determined instead from strats.Bet.bet_type instead. |
TAB Horse IDs [Mandatory]
Depending on the bet type, we will need either 1, 4, or 6 sets of horse IDs associated with the relevant race(s). To accomodate this the class variable strats.Bet.horse_ids
is a list of lists. For a single race bet types this list only has one element: the list of TAB horse IDS for that race. As an example of the string for such a case is:
self.horse_ids.append([1,2,4,5,6,8,9])
Here is an example of the statements required for a Quaddie:
self.horse_ids.append([1,2,3,4,5,6,7,8,9,10,11])
self.horse_ids.append([1,2,3,4,5,6,7])
self.horse_ids.append([1,2,3,4,5,6,7,8,9])
self.horse_ids.append([1,2,3,4,5,6,7])
TAB Odds [Mandatory?]
Either the TAB Odds, User Odds, or both must be specified. Depending on the bet type, we will need either 1, 4, or 6 sets of odds associated with the relevant race(s). To accomodate this the class variable strats.Bet.tab_odds
is a list of lists. For a single race bet types this list only has one element: the list of TAB horse IDS for that race. As an example of the string for the single race case is:
self.tab_odds.append([2.0,4.2,4.2,5.5,5.9,"-",11.0])
Any entry of a non-numeric character indicates a scratching for that horse.
Here is an example for a Quaddie:
self.tab_odds.append([5.2,3.2,16.2,5.8,9.3,34.8,6.7,9.7,14.3,10.5,60.])
self.tab_odds.append([1.3,10.0,12.0,3.1,15.1,1.6,2.3])
self.tab_odds.append([8.3,31.0,4.2,10.0,6.0,7.2,3.2,20,42.6])
self.tab_odds.append([31.7,13.7,4.7,22.6,11.7,2.4,11.7])
User Odds [Mandatory?]
Either the TAB Odds, User Odds, or both must be specified. Depending on the bet type, we will need either 1, 4, or 6 sets of odds associated with the relevant race(s). To accomodate this the class variable strats.Bet.user_odds
is a list of lists. For a single race bet types this list only has one element: the list of TAB horse IDS for that race. As an example of the string for the single race case is:
self.user_odds.append([2.0,4.2,4.2,5.5,5.9,"-",11.0])
Any entry of a non-numeric character indicates a scratching for that horse.
Here is an example for a Quaddie:
self.user_odds.append([5.2,3.2,16.2,5.8,9.3,34.8,6.7,9.7,14.3,10.5,60.])
self.user_odds.append([1.3,10.0,12.0,3.1,15.1,1.6,2.3])
self.user_odds.append([8.3,31.0,4.2,10.0,6.0,7.2,3.2,20,42.6])
self.user_odds.append([31.7,13.7,4.7,22.6,11.7,2.4,11.7])
Aggregation of IDs and Odds
It may be more convenient (and doesn’t affect the bet logic) if the TAB IDs and odds (user and/or TAB) are grouped together:
self.horse_ids.append([1,2,3,4,5,6,7,8,9,10,11])
self.tab_odds.append([5.2,3.2,16.2,5.8,9.3,34.8,6.7,9.7,14.3,10.5,60.])
self.user_odds.append([4.1, 3.8, 19.1, 8.0, 7.6, 35.8, 7.2, 11.1, 11.6, 10.9, 56.8])
self.horse_ids.append([1,2,3,4,5,6,7])
self.tab_odds.append([1.3,10.0,12.0,3.1,15.1,1.6,2.3])
self.user_odds.append([1.6, 13.0, 7.2, 2.8, 20.8, 2.3, 1.9])
self.horse_ids.append([1,2,3,4,5,6,7,8,9])
self.tab_odds.append([8.3,31.0,4.2,10.0,6.0,7.2,3.2,20,42.6])
self.user_odds.append([5.0, 34.8, 5.3, 14.3, 4.3, 8.5, 3.2, 28.9, 61.3])
self.horse_ids.append([1,2,3,4,5,6,7])
self.tab_odds.append([31.7,