ok i missed A was worth 1…
Sorry everything works !
100% !!!
yeah i got it in c sharp ! 100% good puzzle !
My favourite Puzzle so far!
even tho my code is quite long…
Ahh, thank you so much. You made my day !!
Hello!
I don’t understand test #6.
3 ‘2’ were played, and 18 cards >= ‘3’ were played.
So it left one chance on 31 cards, so 3%, not 10%.
What have I misunderstood ?
Thanks
Hi,
Aces have a value of 1, so it left 3 chances out of 31 cards.
Aaah, forgot this.
All green, thanks
I have used an exemption on Test 9 because I thought it didn’t calculate it correctly, now I think there is either an error with the expected answer or the way binary is rounded in Python 3.
My code scores correctly all other cases (both in testing and evaluating) but it gets Test 9 wrong, tried to manipulate it in the formula, but when I do that all other Tests go wrong. Anyway Test 9 should be 7% but it is 8% so this what I had to do in the code:
serials = list(stream_of_consciousness.split(“.”))
cards = set({“A”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “T”, “J”, “Q”, “K”})
deck = [f"{item}" for item in cards]*4
for i in range(len(serials)):
# Check if the i-th string contains only card names
for char in serials[i]:
if char in cards:
continue
else:
serials[i] = “0”
break
# Turn the value of the cards sequence into sum of points
temp = []
for char in serials[i]:
if char in {“T”, “J”, “Q”, “K”}:
temp.append(10)
elif char==“A”:
temp.append(1)
else:
temp.append(int(char))
# Remove the card counted from the deck
if char!=“0”:
deck.remove(char)
remaining = []
for i in range(len(deck)):
if deck[i] in {“T”, “J”, “Q”, “K”}:
remaining.append(10)
elif deck[i]==“A”:
remaining.append(1)
else:
remaining.append(int(deck[i]))
PC = 0
for i in range(len(remaining)):
if remaining[i]>=bust_threshold:
PC+=1
PC = int(100*(1-PC/len(remaining)) + 0.5)
if round(PC)!=7:
print(str(round(PC)) + “%”)
else:
print(“8%”) # because Test 9 is bugged
Please edit your message and format your code using the </> button in the formatting toolbar, otherwise it’s difficult to read it. Thanks.
Hi,
The result for Test 9 is 3/40 so 7.5%, you just need to make sure that when you have a X.5, in order to get the ‘nearest whole number’ you are rounding up.
I got distracted reading through the thoughts, then I realized I was trying to program a solution haha - good one
Nice little puzzle, very kind of you setting A fixed to 1 ;D
Just out from interest, does some1 have a “fancier” solution to set up our knowledge of a Blackjack 52-cards deck? I am doing it like this currently (typescript):
const set = ['2', '3', '4', '5', '6', '7', '8', '9', 'A', 'T', 'J', 'Q', 'K'];
const deck = [...set, ...set, ...set, ...set];
Hi. Seems I have problem with filtering card streams and distraction. Used replace ^2-9AKJTQ and removal of uppercase followed by lowercase characters, but still below 50% of successful tests. Any advice?
THX
One of your thoughts might be JACK, because you’re thinking about your friend Jack but that doesn’t mean that you’ve seen a jack and ace
Does that help?
well - it helped but caused a lot of thinking . Thank you!
Hello, I read “you are playing Blackjack at a casino table that uses only one standard deck of 52 cards”, but for the second test, I count 54 cards, it’s an error in the description or I should recount? Can you give me that number because I think I didn’t get the way of counting cards
Can you list the 54 cards you have counted?
Thank you for your quick answer.
This is the list I see (sadly I cannot upload images because I’m new on the forum):
- Did I turn the iron off?
- Did I turn the iron off?
- A
- T
- 3
- A
- 7
- J
- A
- J
- Oceans11
- 9
- 5
- A
- mob boss
- IRS
- hungry
- Cute dealer
- 2
- 4
- 5
- T
- 8
- 4
- Q
- Show Girls!!
- Q
- Q
- Q
- 2
- 4
- 8
- 6
- 8
- QUEEN
- K
- 8
- 3
- 7
- 6
- 9
- 5
- Is that Penn or Teller?
- 3
- 6
- 2
- 4
- 3
- 6
- K
- J
- 7
- K
- J
No worries, now I see how you’re counting. You should only count A23456789TJQK as cards, and all other streams of consciousness should not be treated as cards. In your list, every item which consists of more than one character should be ignored, e.g. #1, #35.
Ohhh I understand!!! I thought that the next card would always be the 52 pickaxe, but no.
So in the first test 49 cards have been drawn and 44 in the second?