Hacker News new | ask | show | jobs
by chrxr 2566 days ago
I wrote a GA for picking an optimal Fantasy Football (soccer, Brit here) team based on player scores from the previous season(1). The team did above average, even though it was hobbled by the fact that I didn't do any transfers after the initial pick.

The knapsack problem(2), of which fantasy team picking is an example, is a classic use case for genetic algorithms.

1) https://github.com/chrxr/ga-prem-team/blob/master/scripts/ga... 2) https://en.wikipedia.org/wiki/Knapsack_problem

2 comments

Wow that's funny I did the exact same thing! I was working at a web/mobile gaming company building a sports draft platform and I was tasked with building a bot player to fill in empty player slots. I used a GA and it worked really well even though I didn't know anything about sports.
Funnily enough I did a similar thing - I was given a list of players with a "point score" and a "price", and I had to choose the best team I could get. One goal-keeper from a set of N, a couple of forwards, a couple of defenders, etc.

The solution my program "evolved" was the best in the company.

https://steve.fi/Software/Football/