R/bj.R

Defines functions bjs

Documented in bjs

#' black jack (simpel)
#'
#' playing black jack (simple) with just 2 cards for each dealer and player
#'
#'
#' @return if u have won or lost vs the bank
#' @export bjs
#'

bjs <- function(){
  cards <- c(seq(1:10),10,10,10,11)
  play <- sum(sample(cards,2))
  deal <- sum(sample(cards,2))

  print(paste0("dealer has ",deal))
  print(paste0("you have ",play))

  if (deal==play){
    print("tie")
  } else if (deal<play){
    print("you win")
  } else {print("you lose")}

}
SchoenbergA/devcreate documentation built on June 12, 2020, 12:01 a.m.