R/exists_s_flush.R

Defines functions exists_s_flush

Documented in exists_s_flush

#' Detect the existance of a straight flush
#'
#'
#' @param cards A list of objects from the S4 Class 'card'.
#'
#' @return list containing a logical representing if there is a flush,
#' and the straight-flush itself if there is one.
#' @export
#'
#' @examples
exists_s_flush <- function(cards){
  suits <- c("Spades","Clubs","Hearts","Diamonds")
  for (i in suits){
    specific_suit <- get_suit(cards,i)
    if (length(specific_suit) < 5) next
    specific_suit <- exists_straight(specific_suit)
    if (specific_suit[[1]]) return(specific_suit) else next
  }
  return(list("logical" = FALSE))
}
dfcorbin/pokersim documentation built on Nov. 13, 2019, 4:21 p.m.