Giter VIP home page Giter VIP logo

run-world-cup-simulations's Introduction

Run-World-Cup-Simulations

A script to simulate a football world cup tournament results

This code simulates a sports tournament by reading in teams and their ratings from a csv file. The tournament is simulated N (default value is 1000) number of times and the chances of winning for each team are calculated based on the number of wins in the simulations.

The main() function ensures the correct usage of the code, reads the teams from the csv file, converts the teams into a dictionary inside a list, casts the "rating" value to an integer, and runs the simulation N number of times. The result of each simulation is stored in the counts dictionary. Finally, the code prints the chances of winning for each team, sorted by the highest chances of winning.

The code has three additional functions:

- simulate_game(): takes in two teams and returns True if the first team wins and False otherwise, using the ELO rating system to determine the probability of a team winning.

- simulate_round(): takes in the remaining teams in the tournament, simulates games between pairs of teams and returns a list of the winning teams.

- simulate_tournament(): takes in the remaining teams in the tournament and continues to simulate rounds until only one team remains. It returns the name of the winning team.

run-world-cup-simulations's People

Contributors

felixoakz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.