add user input for coin probability
This commit is contained in:
parent
ec1b0be158
commit
63269d8c2d
@ -93,6 +93,30 @@ pnorm_between <- function(dataset = vector(), min = 0, max = 0, word = "") {
|
||||
dnorm_plot("out/dnorm_coins.png", sort(data[, 1]), "Coins Normal Distribution", xlab = "Coins")
|
||||
dnorm_plot("out/dnorm_time.png", sort(data[, 2]), "Time Normal Distribution", xlab = "Time (s)")
|
||||
|
||||
pnorm_less(sort(data[, 1]), 5, "coins")
|
||||
pnorm_more(sort(data[, 1]), 5, "coins")
|
||||
pnorm_between(sort(data[, 1]), 8, 10, "coins")
|
||||
min <- 0
|
||||
max <- 13
|
||||
while (T) {
|
||||
cat("Minimum number of coins: ")
|
||||
input <- readLines("stdin", n = 1)
|
||||
input <- as.numeric(input)
|
||||
if (!is.na(input) && input >= min && input < max) {
|
||||
min <- input
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
while (T) {
|
||||
cat("Maximum number of coins: ")
|
||||
input <- readLines("stdin", n = 1)
|
||||
input <- as.numeric(input)
|
||||
if (!is.na(input) && input > min && input <= max) {
|
||||
max <- input
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
pnorm_less(sort(data[, 1]), min, "coins")
|
||||
pnorm_more(sort(data[, 1]), min, "coins")
|
||||
pnorm_less(sort(data[, 1]), max, "coins")
|
||||
pnorm_more(sort(data[, 1]), max, "coins")
|
||||
pnorm_between(sort(data[, 1]), min, max, "coins")
|
||||
|
Loading…
Reference in New Issue
Block a user