Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lisa-Has-Ideas,validated by @cedricdd,@5922 and @_CG_XorMode.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lisa-Has-Ideas,validated by @cedricdd,@5922 and @_CG_XorMode.
If you have any issues, feel free to ping them.
Another hit from Lisa-Has-Ideas. Reminds me of the movie āRain Manā
Thanks. Iām so glad people enjoy my puzzles. I love creating them.
I loved this puzzle. It was educational and really fitting to its diffictulty. Its difficulty is visible at a glance and its description is clear.
Solving it in C++ was a challenge, but that was entirely my choice))
If I had any ideas or criticisms, Iād ask you to reduce the number of tests. I donāt see why you would need this many.
As for ideas, I expected thoughts to be more unique in those different test cases. I even thought that you could collaborate with someone and make an ARG where your answers would be part of a clue for something else. Since puzzle is easy enough, itās rather accessible for anyone with a passing interest in programming.
And judging by other answers, I need to check out other puzzles of yours!
Ha, yes, there are a lot of tests. What I did was I created a program to generate (randomly) all the test cases, and since I had done that, I wanted to āget my moneyās worthā out of it.
True it is probably excessive, but from feedback on prior puzzles I created, people seem to really like lots of test cases. (I know I personally get a little ādopamine hitā every time I see something go green.)
I tried to put humor in the inputs for those interested enough to look (probably not many will, but its sort of like an Easter egg I guessā¦ anyways that was my thought.).
I LOVE that idea about āyour answers would be part of a clue for something else.āā¦ I will keep that idea in mind and see how that might germinate into something. Thank you for that inspiration.
Yes, please do play all my other puzzles
Hi, is streamofconciousness a list type with one number (or word) for each cases or is it just kind of a big box with anything inside
in fact I just donāt understand why it doesnāt work, this is my code:
import sys
import math
stream_of_consciousness = input()
bust_threshold = int(input())
T=J=Q=K=10
A=1
card=[2,3,4,5,6,7,8,9,T,J,Q,K,A]
percentage = [4/52,4/52,4/52,4/52,4/52,4/52,4/52,4/52,4/52,16/52]
percentageChance=0
res=[]
for i in stream_of_consciousness:
if i in card :
res.append(i)
for i in res:
percentage[i]-=1/52
for i in range (len(percentage)):
if i <= bust_threshold :
percentageChance+=percentage[i]
percentageChance*=100
percentageChance=round(percentageChance)
print(str(percentageChance)+"%")
Hey thanks for playing my puzzle. You can see in the test cases what stream of consciousness looks like.
It is one long string.
Remember that just because something is in the stream of consciousness doesnāt mean itās a card.
For example if one chunk in the stream of consciousness is ā2-for-1 buffetā, that doesnāt mean that you have seen a ā2ā card.
so double check on your logic
Hi @Lisa-Has-Ideas, sorry to annoy you,
I will describe what my program do with āTest 1ā :
1 : I split stream_of_consciousness by ā.ā
2 : I remove invalid elements : āsome distractionā and āanother distractionā
3 : So, there are 45 valids cards already played : 2223334445555678678678678TTTTJJJJQQQQKKKKAAAA
4 : Only 2 remainings cards : 2,3 are < 4 :bustThreshold
So my result is 2/7 : 29% and not 67%
I donāt understand in which step Iām wrong. Can you help me ^^ ?
Hi Stat ā
You are not annoying ā¦ I learn from peopleās questions. So thank you for the question.
Look back at the āTest 1ā input. There are four 9s (in other words ā9999ā) that you have ignored. Donāt ignore those
Thanks a lot for your fast response,
it was just a stupid mistake of my part : write to fast ā9,ā instead of ā9ā in my list with all card values. Didnāt think the error would be from here x)
I just finished it now. Thanks for this great puzzle.
HI could you explain the rules
for test1
it remains 2,3,4 in the deck.
so what is mean 2nd string 4 ? what the % of getting 4 ? 33%
also what is mean bustThreshold with simple words. google translate cant translate bust
Hi Alex ā Thanks for playing my puzzle.
The puzzle states: (The bustThreshold is what would make your hand āgo-bustā/lose by going over 21. It isnāt anything you need to calculate; it is provided.)
See image from Wikipedia, especially the part I highlighted
In Blackjack, you do not want the cards in your hand to go over a value of 21. If you do, you lose. So in the puzzle I provide the value you do not want. For example, your hand has a value of 18, so you know that you do NOT want a 4 or higher, because that will make it total of 22 or more and will make you āgo bustā (aka lose)
In other words: In the puzzle I could have said āyour hand is 18, what is the chance of getting a card that doesnāt makes you bust (i.e., makes your hand-total not exceed 21)?ā But I kept it simple and just provided the bust-threshold for you.
Does that help?
thank you for answer
so I understood bust is like burn down/out my score aka looseā¦ okā¦ I know rules of blackjackā¦ but I cant understand till the end what I should calculate
so from mentioned above task >> it remains 2,3,4 in the deck.
and the 2nd string (4) means if I get 4 I looseā¦ okā¦ itās mean that I have 18ā¦ okā¦
but how from that I should get 67% ? do you mean we should calculate % for all cards that will not busted us (all cards that give us <= 21 )?
yes, exactly
thank you sir
finally I did
your A=1 made me to think little bit
Is test #23 broken ?
bust : 2
A2.TAT
thats clearly 3 cards on a possibility of 47 (52-5)
3/47 = 6.38% but the test says its supposed to be 4%
even if its rounded up from 3.51 to 4.49 I dont understand how it could be 4% for a 2 on next draw
thank you !
Howāve you got 3 cards? There are 4 aces, everything else is bust and 2 of the aces have already been dealt.
Hi. Thanks for playing my puzzle. I think RoboStac responded well to your concern. Two aces have been played. Therefore 2 aces remain. Hopefully that gets you going.