Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lanfeust,validated by @Timinator,@_SG_Sebastien and @_SG_Jarjar.
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 @Lanfeust,validated by @Timinator,@_SG_Sebastien and @_SG_Jarjar.
If you have any issues, feel free to ping them.
I don’t know Bridge, can someone explain how do we know if a contract was won or lost ? I’m unable to find this in the statement.
You win the contract if the number of tricks won (input #3) is greater than or equal to 6 + the bid in the contract (the number 1…7 within input #2)
Thank you !
I was also stuck on this point, it’s not very clear in the statement so thank you!
Hi everyone,
I’m having trouble with test cases 06, 07, and 08.
Tests 1-5 pass, but I suspect the issue lies with the “Doubling” logic in Bridge scoring.
Despite reviewing the rules several times, I’m still struggling to pinpoint the problem.
My code fails with these inputs from test case 06:
Any insights would be greatly appreciated!
I’m finding this challenging and could use a fresh perspective.
Thanks in advance!
Can you show the details of the score calculations for the inputs you’ve failed? Something like this:
“NV 4HXX 10”:
4 x 30 (contracted tricks, Hearts) x 4 (redoubled) +
300 (non-vulnerable game bonus) +
100 (redoubled additional bonus)
= 880
We can then check which areas go wrong.
Here is the detailed breakdown you requested:
“V 3NTXX 10”:
100 (contracted tricks, NT) x 4 (redoubled) +
500 (vulnerable game bonus) +
100 (redoubled additional bonus) +
200 (overtricks)
= 1200
“V 3CX 10”:
3 x 20 (contracted tricks, C) x 2 (doubled) +
500 (vulnerable game bonus) +
50 (doubled additional bonus) +
100 (overtricks)
= 770
“NV 1DXX 9”:
1 x 20 (contracted tricks, D) x 4 (redoubled) +
50 (non-vulnerable game bonus) +
100 (redoubled additional bonus) +
200 (overtricks)
= 430
Thank you so much for helping.
“V 3NTXX 10”:
100 (contracted tricks, NT) x 4 (redoubled) +
500 (vulnerable game bonus) +
100 (redoubled additional bonus) +
200 (overtricks) ← should be 400 because “These numbers are themselves doubled for redoubled contracts.”
= 1200 ← hence should be 1400
“V 3CX 10”:
3 x 20 (contracted tricks, C) x 2 (doubled) +
500 (vulnerable game bonus) +
50 (doubled additional bonus) +
100 (overtricks) ← should be 200 because vulnerable
= 770 ← hence should be 870
“NV 1DXX 9”:
1 x 20 (contracted tricks, D) x 4 (redoubled) +
50 (non-vulnerable game bonus) +
100 (redoubled additional bonus) +
200 (overtricks) ← should be 400 because “These numbers are themselves doubled for redoubled contracts.”
= 430 ← hence should be 630
Thanks to you! You pointed out a detail I kept missing despite reading the description multiple times. With your help, I solved the puzzle with a 100% score!
Why didn’t anyone write that the condition is incorrect:
if there were tricks won in excess of what was contracted, these overtricks are worth their nominal value for normal contracts, but if the contract was doubled, then overtricks are worth 100 points when non-vulnerable, and 200 points when vulnerable. These numbers are themselves doubled for redoubled contracts.
Nowhere before this is it mentioned what “nominal value” means - but here you can still guess that we are talking about the first point
“if the trump is a minor suit (Clubs or Diamonds), contracted tricks (over 6 !) are worth 20 points each, for a major suit (Hearts or Spades), it is 30 points each, and for No Trump, the first trick is worth 40 points, and the next ones 30 points. If the contract is doubled, then so is the value of each trick, and if it is redoubled, the value is multiplied by 4.”
, but this is not obvious, and if you figured it out (and also figured out that you do not need to apply a multiplier to the resulting number), you will find a second omission, namely, that for overTricks, this rule does not apply:
" for No Trump, the first trick is worth 40 points"
, but you yourself will not be able to understand this, only open the link to Wikipedia, after you get paranoid checking your solution.
Will be glad to read your comments about this topic: @Timinator @_SG_Sebastien @_SG_Jarjar
I have read your post several times. I do not see the “incorrectness” you reference.
What else could “nominal value” mean? For confusion to exist, there must be more than one option from which to choose the meaning. I need help seeing the other options.
Are you wanting the author to explicitly state that all contracts must be at least 1? For the rule above to apply to overTricks, wouldn’t you need a contract of 0 in order for the “first trick” to be part of the overTricks instead of the tricks?
The rules of bridge are complicated, and I remember reading the puzzle’s goal statement several times when doing the puzzle, but even today, I do not see any errors or omissions in the instructions.
“nominal value” - you are literally not given a definition of this value in the context of the task, I initially thought that this means that it is equal to the number of overTricks, I am not playing a guessing game, but solving a problem.
If “nominal value” - obeys the first rule, then how do I know that the nominal value of the first overTrick in the case of NT should not obey this rule, and it turns out in this case THERE IS NOT ENOUGH A DESCRIPTION OF WHAT THIS NOMINAL VALUE IS EQUAL TO!!!
I think you have a point. I asked ChatGPT, “How would you describe nominal value of tricks in the card game bridge?” The response was:
In bridge, the concept of “nominal value of tricks” isn’t a standard term, but we can interpret what you’re asking based on similar principles from economics and bridge scoring.
After drawing analogies to economics, ChatGPT came up with:
Example — Nominal Value of Contract Tricks (for scoring):
Contract Type Trick Score (per trick above 6) Clubs ( )
20 points per trick Diamonds ( )
20 points per trick Hearts ( )
30 points per trick Spades ( )
30 points per trick Notrump (NT) 40 for the first trick, 30 for each after
So, ultimately, I believe you are correct that we have all interpreted the “nominal value of tricks” in similar fashion to ChatGPT, as compared to this interpretation being explicitly linked to the word nominal in the writeup.
We live in sad times when a person can no longer use his mind/logic/ability to read and analyze words, but asks questions to ChatGPT.