Bridge: SAYC Openings
Description:
Background
Contract bridge is one of the world's most popular card games and dates back to the nineteenth century. It's played with a standard deck of cards. The cards are ranked from 2 (the lowest) through the Ace (the highest). The suits are also ranked Clubs (lowest), Diamonds, Hearts, Spades, and No Trump (highest), but the suit ranking is irrelevant for this kata. The game is played with four players, in partnerships. All the cards are dealt and the bidding occurs. Players take turn bidding or passing until a contract is decided (see below), then the hand is played. The play itself is a standard trick-taking game in which the first player "leads" a card and the others must follow suit if they can. If they cannot, then they can play any card they wish. The winner of the trick is the one who played the highest trump (if any) or the highest card of the suit lead. The winner of the trick leads to the next trick. When all the cards are played, points are awarded to the partnerships depending on the type of match you're playing.
Your Task
Your code must accept a string of characters representing an initial hand of 13 cards and return an appropriate bid. This kata focuses solely on the opening bid. It is assumed in every case that you are the first player to speak in the bidding round (you don't have to worry about competitive bidding or fourth-seat openers). You can also ignore scoring altogether and concepts like vulnerability. You will simply evaluate each hand against a standard set of opening rules.
Bidding
The language allowed in the bidding phase is restricted to the following:
- a number between 1 and 7 followed by a suit, including "no trump," represented by an "N" (e.g.,
2C
,3N
,4H
) pass
double
(not used in this kata)redouble
(not used in this kata)
Hand Evaluation
To evaluate the strength of your hand you need to know know how many high-card points (HCP) you have.
- Aces are worth 4 HCP
- Kings are worth 3 HCP
- Queens are worth 2 HCP
- Jacks are worth 1 HCP
The cards 10 (T
) through Ace are called "honours."
The suits Clubs and Diamonds are called the "minors," and Hearts and Spades are the "majors."
SAYC Opening Conventions
Bridge bidding is a complex beast, and there are many well-established bidding systems. The one most widely adopted is Standard American Yellow Card. The conventions for opening are as follows:
If your hand meets the "Rule of 20" (total HCP plus the length of your two longest suits must equal at least 20):
- Normally open five-card majors in all seats.
- Open the higher of long suits of equal length: 5-5 or 6-6.
- Normally open
1D
with 4-4 in the minors. - Normally open
1C
with 3-3 in the minors. - Notrump openings show a balanced hand and can be made with a five-card minor suit.
1N
= 15-172N
= 20-213N
= 25-27
- With 22+ points and an unbalanced hand, open
2C
If you have 6+ HCP and a long suit with 2 of the top 3 or 3 of the top 5 honours:
- Open 2 of the suit if you have 6 cards in the suit
- Open 3 of the suit if you have 7 cards in the suit
- etc.
- The exception to this, of course, is
2C
, which is reserved for big hands. So for Clubs,3C
is for 6 cards and4C
is for 7.
Similar Kata:
Stats:
Created | Jun 3, 2017 |
Warriors Trained | 263 |
Total Skips | 137 |
Total Code Submissions | 165 |
Total Times Completed | 8 |
Python Completions | 8 |
Total Stars | 7 |
% of votes with a positive feedback rating | 75% of 4 |
Total "Very Satisfied" Votes | 3 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 3 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 6 kyu |