Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #regular mode
- chassis.p <- 0.0833
- neuro.p <- 0.0769
- system.p <- 0.0564
- bp.p <- 0.0564
- n <- 10000
- runs <- rep(NA,n)
- for (i in 1:n){
- parts <- rep(NA,4)
- t <- 1
- while (sum(is.na(parts))>0) {
- x1 <- replicate(2,sample(2,1,prob=c(chassis.p,(1-chassis.p))))
- if (sum(x1==1)>0) parts[1] = 1
- x2 <- sample(2,1,prob=c(neuro.p,(1-neuro.p)))
- if (x2==1) parts[2] =1
- x3 <- sample(3,1,prob=c(system.p,bp.p,(1-system.p-bp.p)))
- if (x3==1){
- parts[3] <- 1
- } else if (x3== 2)
- parts[4] <- 1
- t <- t+1
- }
- runs[i] <- t
- }
- #elite mode
- #rotation A
- #khora chassis, lato receiver
- rot.A.prob <- c(0.0316, 0.0201, 1- (0.0316+0.0201))
- #Khora Neurop, Braton Barrel, Braton Receiver, Lato BP
- rot.B.prob <- c(0.0369, 0.0369, 0.0369, 0.0201, 1- (0.0369+ 0.0369+ 0.0369+ 0.0201))
- #khora system,khora bp, braton stock, braton bp, lato barrel,
- rot.C.prob<-c(0.0316,0.0316,0.0316,0.0201,0.0316)
- rot.C.prob <- c(rot.C.prob, 1-sum(rot.C.prob))
- n <- 10000
- runs.khora <- runs.braton <- runs.lato <- rep(NA,n)
- for (i in 1:n){
- khora <- braton <- rep(NA,4)
- lato <- rep(NA,3)
- t <- 1
- condition = rep(0,3)
- while ( prod(condition) ==0 ) {
- x1 <- replicate(2,sample(length(rot.a.prob),1,prob=rot.A.prob))
- if (sum(x1==1)>0) {
- khora[1] <- 1
- } else if (sum(x1==2) >0) {
- lato[1] <- 1
- }
- x2 <- sample(length(rot.b.prob),1,prob=rot.B.prob)
- if (x2==1) {
- khora[2] <- 1
- } else if (x2==2){
- braton[1] <- 1
- } else if (x2==3){
- braton[2] <- 1
- } else if (x2==4){
- lato[2] <- 1
- }
- x3 <- sample(length(rot.C.prob),1,prob=rot.C.prob)
- if (x3==1) {
- khora[3] <- 1
- } else if (x3==2){
- khora[4] <- 1
- } else if (x3==3){
- braton[3] <- 1
- } else if (x3==4){
- braton[4] <- 1
- } else if (x3==5) {
- lato[3] <- 1
- }
- if (condition[1] ==0 & sum(is.na(khora))==0) {
- condition[1]=1
- runs.khora[i] <- t
- }
- if (condition[2] ==0 & sum(is.na(braton)) == 0) {
- condition[2]=1
- runs.braton[i] <- t
- }
- if (condition[3] ==0 & sum(is.na(lato)) == 0) {
- condition[3]=1
- runs.lato[i] <- t
- }
- t <- t+1
- }
- }
- #nidus
- p <- 0.1429
- prob <- c(p,p,p,1-3*p)
- N <- 10000
- run.nidus <- rep(NA,N)
- for (i in 1:N) {
- condition <- 0
- full.set <- 1:3
- t <- 1
- while (condition == 0){
- new <- sample(4,1,prob=prob)
- if (new %in% full.set) {
- full.set <- setdiff(full.set, new)
- }
- if (length(full.set)==0)
- condition <- 1
- t <- t +1
- }
- run.nidus[i]<- t-1
- }
Advertisement
Add Comment
Please, Sign In to add comment