Comments (7)
How many teams, divisions, and conferences do you have? It looks like that code is actually generating divisions of size 3 not size 4. i//3
Gives the following pairs of values:
0,0
1,0,
2,0,
3,1,
4,1,
5,1,
6,2,
...
All divisions should be the same size. And every conference should be the same size too.
That exception just means that no valid solution was found after 100 attempts for that week (you could try increasing the number of attempts). I should change the code to actually describe the exception more clearly.
Not ruling out there isn't a bug but please let me know those values. And then what your game_types_per_week
variable looks like
from tutorials.
my comment was also bad next to that i//4. Updated in my last commits to reflect what it actually is doing
from tutorials.
Yes I have 12 teams in the league with 4 divisions made up of 3 teams each. There are 2 conferences with 6 teams in each each. So two divisions within each conference. I increased the attempts to 1000 and it's still failing. This is my game_types_per_week
['divisional',
'non_conference',
'non_conference',
'conference',
'divisional',
'divisional',
'conference',
'divisional',
'conference',
'conference',
'divisional',
'non_conference',
'non_conference',
'divisional']
from tutorials.
I think I found where the issue is coming from. It doesn't look like conferences
is generating as expected. The output is the same as divisions
and when I look at universes['conference']
I see empty lists. Any potential issue here:
conferences = defaultdict(list)
conference_nums=[]
for division, teams in divisions.items():
division_num=len(teams)//2 #2 conferences
conferences[division//division_num]+=teams
conference_nums.append(division_num)
conferences
from tutorials.
Ok I got conferences to work now by just setting division_num=2
and the output is:
defaultdict(list,
{0: ["Team One",
'Team Two',
'Team Three',
'Team Four',
'Team Five',
'Team Six'],
1: ['Team Seven',
"Team Eight",
'Team Nine',
'Team Ten',
'Team Eleven',
'Team Twelve']})
And I got my universes['non_conference']
and universes['conference']
to output the correct info. However I am still seeing this error
Exception: No valid matchups found for week 0 after 1000000 attempts. Please check your settings are valid or try increasing the number of attempts
from tutorials.
Ah sorry, the code does not work with an odd number of teams in a division or conference. There was a bug in the conferences code you found as well.
The schedule generator does not support an odd number of teams in a division since each week is a "themed" week. Divisional week requires every team to play a team from their division and after the first matchup is set the third team in the division has no one left to play. You could probably edit the code to make it work for your use case though. Or do 2 divisions of size 6. See the new notebook https://github.com/rogerfitz/tutorials/blob/master/fantasy_football_schedule_generator/jman_issue.ipynb (it might take a few runs to get this schedule to generate validly but it should work most of the times)
from tutorials.
Maybe in a follow up video I'll add support for odd numbered teams (it is a more complicated approach but would be way more flexible), for now I added a warning in the notebooks, README, and Youtube video
from tutorials.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tutorials.