Spades Problem (retired)
Description:
In the game of spades, there are four players. The first dealer is chosen at random, and the turn to deal rotates clockwise. The cards are shuffled and the dealer deals all 52
cards to the other three players in clockwise order beginning with the player on dealer's left until everyone has 13
cards in their hands.
The first round of the game is for each player to lay down their lowest club, where clubs are ordered from low to high as: 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.
Once all four lowest clubs are on the table, the player who threw the highest of those four cards wins the cards (i.e. that player wins the "trick"). If a player has no clubs, he or she must discard a diamond or a heart, and that card has no chance of winning the trick. If a player has no clubs, no hearts, and no diamonds, then the player must play a spade, and will be guaranteed to win the trick.
Given a card given in the format "2H" , where "2" is the value and "H" stands for hearts which is the suit, compute for the winning probability of that card. Results must contain two significant digits after the decimal.
Note: Tolerance is 4e-2
Sample Input | Sample Output |
---|---|
2C | 0 |
10C | 9.08 |
KC | 3.49 |
9C | 11.87 |
2S | 0 |
AH | 0 |
Similar Kata:
Stats:
Created | Jun 25, 2019 |
Warriors Trained | 21 |
Total Skips | 0 |
Total Code Submissions | 25 |
Total Times Completed | 6 |
Java Completions | 6 |
Total Stars | 2 |
% of votes with a positive feedback rating | 0% of 4 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 4 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |