DEV Community

Suleman
Suleman

Posted on • Originally published at collectednotes.com on

I suck at FPL πŸ’©

For those of you who don't know what FPL is, let me give you an in-depth, far too detailed explanation (yes, you can skip it πŸ€¦πŸΎβ€β™‚οΈ):

"Some people believe football is a matter of life and death. I am very disappointed with that attitude. I can assure you it is much, much more important than that."

  • Bill Shankly

Fantasy Premier League, often shortened to FPL, is an online football game that allows players to manage a team based on players currently playing in the English Premier League. The game allows players to live out their dream of being a football manager. It heightens each game week and makes less interesting games more intense since you might have a player playing on your fantasy team. It raises the stakes from just cheering on your favorite team to analyzing matches, looking to gain an edge on your friends that are in the same mini-league. There is so much data that is recorded every week on each player's performance, that there are dedicated online personalities that break the data down and give you insights into the game weeks.

To better understand FPL, one needs to understand the rules and how the game is played. FPL is tightly connected to the EPL; before the season starts, every FPL manager is given a pot of 100 million in game currency and is tasked with selecting 15 players. Given that players are valued at different prices, this introduces the first limitation set on the managers. The next limitation imposed on the managers is that there can only be a certain number of players for each position, and from each team, you can only pick 3 players. For the different positions, you need to pick:

  • 2 goalkeepers
  • 5 defenders
  • 5 midfielders
  • 3 forwards

Finding the right players is crucial. When the season starts, you are only given 1 transfer a week, and you can only roll the transfer one week at a time, giving you a max of 2 free transfers at any time. You are allowed to transfer more than this; however, this will be deducted from your total points. It's called taking a hit.

Now that the team has been chosen, every week you field 11 players. You can set up your team as you like, as long as there is at least 1 goalkeeper, 3 defenders, and 1 forward. Essentially this means you can play many different formations. Each game week every player is awarded points based on their real-life performance. A goal scored by a forward gives you 4 points, while a goal scored by a defender or a goalkeeper gives you 6 points. The aim of the game is to collect as many points as possible throughout the season.

There are some extra details that have been left out for brevity, however, one can see that there are a myriad of moving parts for a manager to control. Everything from rotating the team based on players' opponents, selling and buying players. Most managers pick players based on the eye test. This is more or less based on how they feel about a player. There is a lot of luck in FPL, given all the factors that impact a player's performance. However, there are statistical data that is also collected on each player. From the number of minutes played to the number of big chances created. This data, aggregated, can tell us something about the game and also about the players.

Did you skip all that? Okay, FPL is a fantasy sports game. Real-world achievements by players translate to in-game points. Now that you are caught up, I suck at the game.

I'm currently, as of game week 23, in 73,025th place. Context: there are, as of November 14, 10.5 million players. So not bad. However, if the mini-leagues I'm a part of are an indication of the number of engaged players, I would say 70-80% of the people registered are not playing, at least consistently. Which means there are more like 2 million players. You might deem it impressive, however, I have been getting assistance from someone. An AI. Yes, I have been using performance-enhancing tools to win my mini-league. Haven't we all? No? Okay.

I use Drafthound; they have a pretty good app and website. And they have done pretty well by me. I have used them and gotten some ideas. When I try to outsmart the AI, it never ends well, so I just follow it at this point.

I like it, but I want it to do more. I want it to play the game for me. I currently use too much brainpower thinking if I should use chips, roll, or rotate injured players. It's good, but not great. I want to create something great. An AI that actually plays the game for you based on your current team each week.

Idea

So, this is the idea. I want a website I can go to. I enter in my team name. Then it displays my current team, with stats for the coming 3 weeks. Calculating points and other metrics. I then want a button at the bottom that says "Help me!" , when this button is pressed it will then do the following:

  1. Calculate what transfers you should do
  2. If you should use any of your chips
  3. If you should just keep your team as is

Under the hood, I want it to create a power ranking of all available players, taking into account the likelihood of injury, team schedule, form, and other metrics. The power ranking should be for estimated total points at the end of the season, giving us a look into the future and making transfers and chip use smarter.

This is how I'm thinking the AI will work:

  1. Create the ultimate team
  2. Calculate the likelihood of double game weeks
  3. Get current team info
  4. Find restrictions, like the number of players from the same team, used chips, number of free transfers, etc.
  5. Compare the current team to the ultimate team created by AI
  6. Make as many changes as possible to the current team to get closer to the ultimate team, including if using chips will be advantageous. Also, if taking hits is reasonable
  7. Evaluate if players on the team clash, if a defender is facing a striker, etc.
  8. Print out the chosen team

In order for this to work, I need a couple of things:

  1. A database containing all current players and their information
  2. A database of as much previous seasons as possible to train the AI
  3. A website that can take user input and display team information
  4. An AI

Moving forward

Now, you might be forgiven for thinking that I have the necessary skills to create such a monster. I don't. I'm currently learning Python and I'm doing my master's in computational math and physics. I do, however, want to be able to do this, so I might as well do it and learn along the way.

I thought maybe blogging my process would be a great way to keep me going and accountable to not give up, perceived public shaming and all that.

So, I will be posting once a week, giving an update on the process. The goal is to make it work, but more so to learn. It's an ambitious task, but reach for the stars ✨ and land on the moon πŸŒ™ . I'm currently on Earth 🌍 in my room 🏠.

Space man out πŸ‘¨πŸΎβ€πŸš€

Disclaimer: Yes, I put the text through chatgpt for spellcheck and jokes.

Top comments (0)