FanDuel lineup generator
I wrote this app to generate lineups with up to 18 players in FanDuel. Writing the backend algorithm was fun, and turned out to be pretty simple math. This is a static webpage, so nothing works. See the setup instructions below for running the server and front end.
Setup
1. Make sure you have angular cli installed
npm install -g angular-cli
2. Clone the repo
git clone https://github.com/mattgorb/FanDuel_LineupGenerator.git
3. Install dependencies
npm install
4. Run
npm run build
5. Navigate to localhost:3000 in your browser.
Math
FanDuel football lineups consist of 1 QB, 2 RB's, 3 WR's, 1 TE, 1 D, and 1 Kicker. Say I pick 2 QB's, 4 RB's, 5 WR's, 3 TE's, 2 Defenses, and 2 Kickers. The number of unique combinations here is simple multiplication of binomial coefficients.
A binomial coefficient (n choose k) is the number of ways of picking k unordered outcomes from n possibilities, also known as a combination or combinatorial number.
For example, I picked 5 WR's. Since there are three slots in the lineup for WR's, there are (5 choose 3) unique combinations. Mathematically, this means there are (5*4*3)/(3*2*1)=10 unique combinations.
So in total, there are (2 choose 1)*(4 choose 2)*(5 choose 3)*(3 choose 1)*(2 choose 1)*(2 choose 1) combinations.
This equals (2)*(6)*(10)*(3)*(2)*(2)=1,440 lineup combinations.
Finally, here is what the form looks like. I included a column for average points of each player in case you want to choose your lineups based on total average points. Winning combinations are usually in the 65th-75th percentile of average points.