Giter Club home page Giter Club logo

riskgamesimulator's Introduction

RiskGameSimulator

Simulator to find probability of victory in the board game Risk

It uses C++ to simulate and therefore generate odds for different outcomes. Pre-generated data has been made in simulation_data, generating upto 50 attacking troops vs 50 defending tropps, and with n_runs at 500 000.

RiskSimulator

The general usage for the RiskSimulator that generates the dataset is:

RiskSimulator.exe {output folder} {max attackers to simulate} {max defenders to simulate} {n_runs}

Please make sure the {output_folder} exists, or the program won't run.

Risk Visualizer

If you don't wish to create your own dataset, but just visualize, you just need to use the RiskVisualizer. You will have access to premade simulations of up to 50vs50. The basic usage is to first install the requirements (PyPlot), and then just use the program:

pip install -R requirements.txt
python RiskVisualizer.py

After that, the program will ask of what you want to simulate, which should be pretty straight forward! Good luck!

Graph composition

So, the graph made basically shows the probability of win for either side, and having atleast x troops remaining (negative values for defender). The p in the legend is the probability of attacker victory. obraz For exmaple in the example here, there's a fight of 2 attacker troops vs 1 defender troop, with a 75,41% chance of the attacker winning. There's a 75,41% chance of the attacker having atleast one troop remaining, and about 60% chance of him having 2 troops remaining.

Fun statistics

Having that in mind, we can make some interesting statistics

Equal amounts of attackers and defenders

obraz As we see here, with an equal amount of attackers and defenders, the defender has an advantage up until 5v5, where the probability of the attacker winning is 50,83%.

Defender advantage - 1 troop

obraz

Here, the defender has one more troop than the attacker. We see the attacker having a quite low win probability up until 11v12, where he will win 50,54% of the time.

Defender advantage - 2 troops

obraz

The same trend can be observed here, up until 17 vs 19

Defender advantage - 3 troops

obraz

Same here, up until 23vs26.

Attacker advantage

obraz As we see, with the attacker having one troop advantage, he willbasically always have the odds on his side.

riskgamesimulator's People

Contributors

gronnmann 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.