Last active
July 3, 2020 06:32
-
-
Save tmasjc/d98b573de473eea8910b00f85e6b4cb0 to your computer and use it in GitHub Desktop.
another dynamic programming
This file contains hidden or 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
| cuts = 0.8 # cutoff level | |
| maxN = 100 # number of trials | |
| run_game <- function(vec, cutoff, N) { | |
| # browser() | |
| if (length(vec) > N) { | |
| return(vec) | |
| } | |
| pass = ifelse(mean(vec) >= cutoff, 0, 1) | |
| vec = c(vec, pass) | |
| run_game(vec, cutoff = cutoff, N = N) | |
| } | |
| run_game(1L, cutoff = cuts, N = maxN) | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to solve C-stack limit problem?