Description Usage Arguments Value Author(s) Examples
View source: R/straightdraw1.R
Sees how many possibilities there are that will make a straight for you.
1 |
x |
returns 26 if you already have a straight. returns 4 is there are 2 possibilities for a straight. returns 2 for a gutshot straight draw. returns 0 otherwise.
Frederic Paik Schoenberg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | straightdraw1(c(2,5,6,7,9,14))
straightdraw1(c(4,5,6,7,9,14))
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function(x){
## returns 4 is there are 2 possibilities for a straight.
## returns 2 for a gutshot straight draw.
## returns 0 otherwise
## Note: returns 26 if you already have a straight!
a1 = 0
for(i in c(2:14)){
a2 = straight1(c(i,x))
if(a2 > .5) a1 = a1 + 1
}
a1 * 2
} ## end of straightdraw1
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.