Last active
September 16, 2019 15:15
-
-
Save dietercastel/e0a7eefa3b5bdeef22948075dcd04da9 to your computer and use it in GitHub Desktop.
RPS julia plotting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Plot of calculating the win chance for g-player Rock, Paper, Scissors. | |
# A winning RPS game contains exactly two options. | |
#Total amount of options BigInt function | |
tot(g) = 3^BigInt(g) | |
#Winning options BigInt function | |
win(g) = 3*2*(2^(BigInt(g)-1)-1) | |
#Calculate the win chance | |
winchance(g) = win(g)//tot(g) | |
xto(n) = range(3,stop=n) | |
yto(n) = map(x-> winchance(x), xto(n)) | |
n=30 | |
x = xto(n) | |
y = yto(n) | |
using Plots | |
using PlotThemes | |
theme(:dark) | |
label = "W(g)/T(g)" | |
# Using LaTeX with the default gr backend was not readable so disabled for now. | |
#using LaTeXStrings #Note that LaTeXStrings is Case-Sensitive | |
#label = L"\frac{W(g)}{T(g)}" | |
plot(x,y,label=label,xticks = x) | |
xaxis!("Groep van g (>2)") | |
yaxis!("Kans op winnaars") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment