Script 1:
Binary Variable + Road Trip String > Game on Date
This script quickly transforms the 60,525 binary decision variables into a readable schedule with games on dates. Pictured below is just a few of those decision variables and a look up table, indicating the road trip a particular team will go on.
Input #1: Road Trip Strings
Team Index | Away Team | 2 | 3 | 4 |
---|---|---|---|---|
1 | Portland | 3 | 4 | 5 |
2 | Sacramento | 3 | 4 | 5 |
3 | Oakland | 2 | 4 | 5 |
4 | LAC | 2 | 3 | 5 |
5 | LAL | 2 | 3 | 4 |
6 | Phoenix | 2 | 3 | 4 |
7 | Utah | 2 | 3 | 4 |
8 | Denver | 2 | 3 | 4 |
9 | OKC | 2 | 3 | 4 |
10 | Dallas | 2 | 3 | 4 |
11 | San Antonio | 2 | 3 | 4 |
12 | Houston | 2 | 3 | 4 |
13 | New Orleans | 2 | 3 | 4 |
14 | Memphis | 2 | 3 | 4 |
15 | Minneapolis | 2 | 3 | 4 |
Input #2: Road Trip Binary
Team Index | Away Team | 2 | 3 | 4 |
---|---|---|---|---|
1 | Portland | 0 | 0 | 0 |
2 | Sacramento | 0 | 0 | 1 |
3 | Oakland | 0 | 0 | 0 |
4 | LAC | 0 | 0 | 0 |
5 | LAL | 0 | 0 | 0 |
6 | Phoenix | 0 | 0 | 0 |
7 | Utah | 0 | 0 | 0 |
8 | Denver | 0 | 0 | 0 |
9 | OKC | 0 | 0 | 0 |
10 | Dallas | 0 | 0 | 0 |
11 | San Antonio | 0 | 0 | 0 |
12 | Houston | 0 | 0 | 0 |
13 | New Orleans | 0 | 0 | 0 |
14 | Memphis | 0 | 0 | 0 |
15 | Minneapolis | 0 | 0 | 0 |
Script #1: Output (Script #2)
Only the output in Red comes from the images above because the binary road trip variables for the other games are outside of the picture. Full schedule output and this script are in the Appendix.
Team Index | Away Team | 12/19/2018 |
---|---|---|
1 | Portland | Portland@Denver |
2 | Sacramento | Sacramento@LAL |
3 | Oakland | |
4 | LAC | |
5 | LAL | |
6 | Phoenix | |
7 | Utah | Utah@LAC |
8 | Denver | |
9 | OKC | |
10 | Dallas | |
11 | San Antonio | |
12 | Houston | Houston@San Antonio |
13 | New Orleans | New Orleans@Oakland |
14 | Memphis | Memphis@Dallas |
15 | Minneapolis | Minneapolis@OKC |
Script #2 Output
This script senses the beginning and end of road trips as well as calculates the total road trip distance. (I chose to use a one game road trip to demonstrate for the website so the tables would be small enough for mobile users to view.) The number of flights = the number of games + 1 to account for the flight home. Therefore, this one game trip has two flights, one there and one back. See appendix for longer road trips.
day | away_team | road_trip_list | road_trip_distance | flight_distance |
---|---|---|---|---|
65 | Sacramento | ['Sacramento@LAL'] | 723.7 | [361.85, 361.85] |
Script #3 Input
Input is only for the actual season. Because games are every other day in the computer generated schedule, no back to backs are guaranteed.
day/team | 10/16/2018 | 10/17/2018 | 10/18/2018 |
---|---|---|---|
Boston | |||
Toronto | |||
New York | |||
Philedelphia | Philedelphia@Boston | ||
Brooklyn | Brooklyn@Detroit | ||
Cleveland | Cleveland@Toronto | ||
Milwakee | Milwakee@Charlotte | ||
Chicago | Chicago@Philedelphia | ||
Indianapolis | |||
Detroit | |||
Washington | |||
Atlanta | Atlanta@New York | ||
Miami | Miami@Orlando | Miami@Washington | |
Charlotte | |||
Orlando |
Script #3 Output
Totals from this output were confirmed by figures displayed on the NBA official site regarding the 2018-2019 season.
day | back_to_back_team |
---|---|
2 | Miami |
4 | Minneapolis |
4 | Boston |
4 | Toronto |
4 | New York |
4 | Brooklyn |