-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCode.R
55 lines (49 loc) · 2.95 KB
/
RCode.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
data = read.table("TOAK.data", header = FALSE, sep = ";");
data = t(data[1:length(data)-1])
print("Probbility to do a Three Of A King in 3 tosses or less:")
length(data[data <= 3])/length(data)
hist(data[data < 11], main = "Repartition of the amount of tosses needed to do a Three Of A King", sub = "(Cropped to 10 tosses)" ,xlab = "Number of tosses", breaks = 0:10)
abline(v = mean(data), col = "red")
abline(v = 3, col ="gray")
text(mean(data),0,paste("mean=",mean(data)), col = "red",adj = c(-0.1,1.2))
data = read.table("full.data", header = FALSE, sep = ";");
data = t(data[1:length(data)-1])
print("Probbility to do a full in 3 tosses or less:")
length(data[data <= 3])/length(data)
hist(data[data < 31], main = "Repartition of the amount of tosses needed to do a Full", sub = "(Cropped to 30 tosses)" ,xlab = "Number of tosses", breaks = 0:30)
abline(v = mean(data), col = "red")
abline(v = 3, col ="gray")
text(mean(data),0,paste("mean=",mean(data)), col = "red",adj = c(-0.1,1.2))
data = read.table("FOAK.data", header = FALSE, sep = ";");
data = t(data[1:length(data)-1])
print("Probbility to do a Four Of A King in 3 tosses or less:")
length(data[data <= 3])/length(data)
hist(data[data < 16], main = "Repartition of the amount of tosses needed to do a Four Of A King", sub = "(Cropped to 15 tosses)" ,xlab = "Number of tosses", breaks = 0:15)
abline(v = mean(data), col = "red")
abline(v = 3, col ="gray")
text(mean(data),0,paste("mean=",mean(data)), col = "red",adj = c(-0.1,1.2))
data = read.table("ss.data", header = FALSE, sep = ";");
data = t(data[1:length(data)-1])
print("Probbility to do a Small Straight in 3 tosses or less:")
length(data[data <= 3])/length(data)
hist(data[data < 11], main = "Repartition of the amount of tosses needed to do a Small Straight", sub = "(Cropped to 10 tosses)" ,xlab = "Number of tosses", breaks = 0:10)
abline(v = mean(data), col = "red")
abline(v = 3, col ="gray")
text(mean(data),0,paste("mean=",mean(data)), col = "red",adj = c(-0.1,1.2))
data = read.table("ls.data", header = FALSE, sep = ";");
data = t(data[1:length(data)-1])
print("Probbility to do a Large Straight in 3 tosses or less:")
length(data[data <= 3])/length(data)
hist(data[data < 31], main = "Repartition of the amount of tosses needed to do a Large Straight", sub = "(Cropped to 30 tosses)" ,xlab = "Number of tosses", breaks = 0:30)
abline(v = mean(data), col = "red")
abline(v = 3, col ="gray")
text(mean(data),0,paste("mean=",mean(data)), col = "red",adj = c(-0.1,1.2))
data = read.table("yams.data", header = FALSE, sep = ";");
data = t(data[1:length(data)-1])
print("Probbility to do a Yams in 3 tosses or less:")
length(data[data <= 3])/length(data)
hist(data[data < 31], main = "Repartition of the amount of tosses needed to do a Yams", sub = "(Cropped to 30 tosses)" ,xlab = "Number of tosses", breaks = 0:30)
abline(v = mean(data), col = "red")
abline(v = 3, col ="gray")
text(mean(data),0,paste("mean=",mean(data)), col = "red",adj = c(-0.1,1.2))
print("Graphs in Rplots.pdf")