Beta

Blackjack, should I hit?

37 of 122davidhu2000
Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • Joachim10 Avatar

    The instructions still seem unclear to me: For example, it says Testing [8, 'A'] and J; Expecting: ['stay', 19]. But if I can choose what an Ace is, whether soft (1) or hard (11), I may opt for soft in this case. My hand is 8+1=9. Hitting Jack brings me to 19. There's nothing wrong with that.

    Moreover, what's supposed to happen if the hand is [9,'A'] and the next card is A. Seems obvious to me that I should choose a soft Ace, having 9+1 in my hand, and then hit next card (Ace 11), totalling 21.

  • dietrichR Avatar

    How do you know if an Ace is 1 or 11. You didn't tell us which situation causes 1 and which situation causes 11.

  • Samarth-Pai Avatar

    If score of ["A",1],7 is 19. Then why ["A,1],"T" is 12?

  • Appuz Avatar

    btw what should the function called!

  • anter69 Avatar

    Python translation kumited -- please check and approve (author is inactive)

  • Voile Avatar

    Edge cases like should return [hit,21] for ([5, 5], A) is not popping up frequently enough in the random tests, code that fails on it will pass after a few resubmits.

    It should be put in the fixed tests.

  • docgunthrop Avatar

    In the description, it states: The card values are selected from the array below. ['A', 2, 3, 4, 5, 6, 7, 8, 9, 'T', 'J', 'Q', 'K']

    At least one test case has 10 representing the 10 card, instead of 'T' as specified in the description. If this is intentional, the description needs to be revised; otherwise the test case needs to be revised.

  • Hacker Sakana Avatar

    And one more suggestion: better keep the type of all possible values consistent. I mean, it feels strange while an argument denoting the rank of a card could be a number or a string.

  • Hacker Sakana Avatar

    If total is 17, stay if it is a hard 17 (7 with a 10).

    What about [8, 9]? Make better explanation in your description.

  • mjstromberg Avatar

    This comment has been hidden.

  • matt c Avatar

    You should not let the user define the function cardValue as then your random tests become invalid.