I've looked through here to find a solution to my question, but I didn't see one.
In R, I'm trying to simulate Deal or No Deal for a project that gets us familiar with the software. I planned for this to be one big for loop but I can't get my second for loop to work. I broke it apart to make it easier to read (and for me to debug/test).
This loop simulates our original case picked that we keep throughout the game.
for(i in 1){
cases <- 1:26
originalpick <- sample(cases, 1, replace = FALSE) #choose a case
casesremaining <- (length(cases) - 1) #subtract original case from cases
}
This loop simulates our first case picked to play.
for(i in 1){
casepicked <- replicate(1,sample(cases[-c(originalpick)], 1, replace = FALSE))
}
My problem is that I am stuck with the possibility that I can choose my original case again. I used sample because I could turn replace off for this very reason, and since that didn't work, I thought that replicate would help. I have seen the update function but I cannot seem to get that to work either.
This is essentially the game, because I have to pick cases until I am left with 2 cases (originally picked case and the one left from cases variable).
I am still fairly new to R, so it could be just my misunderstanding of the functions? Any help would be greatly appreciated!