Inspiration

With the excitement surrounding the 2026 FIFA World Cup in North America, football fans everywhere love step-shifting into the shoes of an international manager, debating tactics, and wondering if an optimized lineup could change tournament outcomes. I wanted to design a concrete, text-driven testing ground to back those tactical arguments with data. As a solo developer, I build an interactive program where users can structurally craft a 4-4-2 formation and execute heavy-duty stress testing against a curated bracket of global squads.

What it does

The World Cup Squad Simulation program is a command-line manager sandbox designed to bring data science and tactical formulation together. Rather than including over-saturated historical giants like Argentina, Spain, Germany, or Portugal, the tool features a meticulously curated selection of 8 competitive international teams that have qualified to the Round of 16 (including hosts USA, and Canada, alongside dark horses like Norway, Morocco, and Paraguay).

Users step into the shoes of a manager to build an interactive 4-4-2 lineup. From there, the program routes the rosters into a backend match engine to execute realistic, highlight-driven 90-minute games. For users wanting heavy-duty statistical proof, it can run large-scale stress tests (up to thousands of consecutive matches) churning the raw data through numpy and exporting distribution data charts via matplotlib.

How we built it

The program was architected entirely from scratch using a modular Python design split across three primary blocks:

  • config.py: Houses deep 26-man roster profiles containing complete player profiles with IDs, ages, positions, and overall ratings, alongside default starting fallback schemes. The player overall data was taken from SoFIFA's (June 30th, 2026 squad data), which itself is extracted from EA FC 26's squads.
  • main.py: Controls user interface inputs, filters real-time player positional fits across designated structural slots (GK, DEF, MID, ATT).
  • attack.py: Calculates relative team strengths, executes minute-by-minute stochastic simulation loops, and processes data aggregation loops to output mathematical outcomes and save visualization figures.

Challenges I ran into

  • Positional Index Lock and Selection Loops: During the implementation of the interactive roster selection utility, we encountered a significant logic bug where the program would become stuck on a single positional slot (such as Goal Keeper or Defender). Even though the user could successfully select a player from the menu, the internal pointer tracking the team's active positional formation failed to increment. As a result, the application allowed infinite player selections for that single position without advancing the lineup configuration state. Resolving this required completely restructuring the selection loop conditionals, ensuring that the lineup array lengths are strictly validated against standard 4-4-2 position quotas before the program updates the index and moves to the next formation tier.

Accomplishments that I'm proud of

  • Building an interactive command-line selection tool that handles user inputs without crashing is incredibly difficult. I am proud of engineering a bulletproof validation pipeline that prevents users from choosing duplicate players, picking numbers outside of the range, or over-allocating spots for single position group. State accurately locks and transitions from selection to simulation flawlessly.
  • By consciously omitting the absolute "best of the best" mega-teams, I created a beautifully balanced tournament environment. Games between my curated squads like Canada, Mexico, Norway, and the USA yield thrillingly competitive results, making manager's tactical structural choices genuinely impactful.

What I learned

  • Coming from an undergraduate background primarily focused on C++, this project served as an excellent exercise in transitioning back to Python's interpreted, dynamic ecosystem. It provides a valuable opportunity to refresh core language syntax, navigate typing differences, and iron out standard execution quirks that arise when pivoting between programming languages.
  • While we had brief exposure to data tools in past coursework, this development cycle forced a much deeper, practical integration of NumPy and Matplotlib. Building this simulation required moving past basic tutorials to implement real-world array manipulation, stochastic probability loops, and automated image generation pipelines.

What's next for World Cup Squad Simulation

  • Increasing the team selection beyond the initial 8 curated nations, to the entire 48 world cup teams.
  • Building an active, mid-management interface. This feature will track real-time player stamina depletion throughout the match, allowing the user to pause execution and substitute bench players to dynamically alter team power ratings.
  • Introducing referee logic that computes random foul evnets based on team defensive aggression. This includes tracking yellow and red card states mapped to specific player IDs, directly triggering real-time team power degradation if a squad is forced to play a man down.

Built With

Share this project:

Updates

Submission history