magnusbakken / espn-fantasy-autopick

A Chrome extension that lets you automatically add active players to the current roster in an ESPN NBA/NHL fantasy league.
MIT License
11 stars 6 forks source link

Feature request: Optimize week #16

Open craigjmidwinter opened 1 year ago

craigjmidwinter commented 1 year ago

At least in the league that I'm in when you specify the max amount of players, the way it works is as long as you are under the max before the day starts on Sunday, you can ice as many players as you have available on Sunday. So the optimal strategy is to either aim for Monday-Saturday ice (limit-1) and then max out sunday, or just go over the limit on the Saturday if it ends up resulting in more players that way.

It would be cool to have a feature to optimize the picks for the week. The way I see this working would be:

  1. Page through the week to determine the optimal lineup for each day ordered by a column selected by the user (ie, fantasy points current season, fantasy points prev season or rostered percentage, etc)
  2. Determine what day the user maxes out on and what the total number for that column would be at the end of that day and store that in a var as a potential line-up
  3. If the day the user maxes out is not the last day of the week, start removing slotted players ranked the lowest in that metric until you have limit-1 players, then fill the next day with every available player and store that as another potential line-up combo
  4. Repeat step 3 until you've figured out the potential maximum rostered player scenarios for the week.
  5. Compare which potential line-up that you stored has the highest tally for the selected column for the week and apply it
magnusbakken commented 1 year ago

Hello Craig! Thanks for the suggestion, and the thorough description. I'm afraid I don't have the time to implement a large feature from scratch at the moment, but if you get the ball rolling with a PR I will definitely help out.

By the way, I noticed you said "ice as many players as you have available". Do you happen to know if what you're describing is an NHL-only feature, or if the same thing is available for the other sports (especially the NBA)? That would have some implications for the implementation.

If this feature were implemented, do you think it should be a separate button in the extension? Or could it somehow detect that this is what you would want from the league settings? At the moment the extension works only with what's available in the DOM, without any custom API calls, but of course adding API calls could be possible.