American Computer Science League, 2008/09 Contest #1
ACSL Bridge (Senior)
Bridge is a 4-handed, 2-team card game that consists of bidding, play and scoring. Accurate bidding is rewarded and inaccurate bidding is penalized. Bidding before the start of play is based upon how many of the 13 possible "tricks" a player thinks his team will win. During play each player lays down one card and a winner of that "trick" is determined by the rules of the game.
Scoring is based upon how many tricks above 6 are won by the bid winner. A bid of 1 says that the team will win at least 7 tricks, a bid of 2 says that the team will win at least 8 tricks and so on. The bid establishes a "line" and only points awarded for tricks under the "line" count towards winning the game. In addition to the bid number, a suit for trump (hearts, diamonds, spades, clubs or no trump) is specified. The table below gives point values for scoring:
No Trump | 40 points for the first trick and 30 points for all others |
Hearts or Spades | 30 points per trick |
Clubs or Diamonds | 20 points per trick |
Vulnerable | 100 points per undertrick |
Not Vulnerable | 50 points per undertrick |
- If a player bids two hearts (needs to win at least 8 tricks ) and wins 8 (2 more than the base amount of 6) tricks, his team wins a game of that match and gets 60 under the line points.
- If a player bids two clubs and wins 9 (one more than the line amount of 8) tricks, his team wins a game of that match and gets 40 under the line points and 20 over the line points.
- If a player bids 4 no trump and wins 11 ( one more than the line amount of 10) tricks, his team wins a game of that match and gets 130 under the line points and 30 over the line points.
- If a player bids two hearts ( needs 8 tricks to score points) and the team wins only 6 tricks (two undertricks), the team loses that game of the match and is penalized by awarding over the line points to the other team.
The penalty differs depending upon whether the bidding team has won a game in that match or not. Not vulnerable means the team has not won a game in that match. Vulnerable means the team has won a game in that match.
The first team to accumulate at least one hundred points below the line wins that match. At that point both under the line scores are reset to zero. Multiple matches are played but over the line points are never reset.
Input
There will be 5 lines of input. Each line will contain three integers and one string. The first integer gives the number of the team (team 1 or team 2) that won the bidding. The second integer gives the bid amount. The third integer gives the number of tricks won. The string gives the suit (T—no trump, H—hearts, S—spades, C—clubs, D—diamonds).Output
For each input line, print in order (team 1 then team 2) the cumulative number of points awarded below the line and above the line for each team. When required, under the line points are reset to zero after the game scores are printed.Sample Input
1 2 8 C 1 1 9 H 2 4 10 H 2 2 11 T 2 3 6 S
Sample Output
40 0 0 0 70 60 0 0 70 60 120 0 0 60 70 90 0 360 70 90
All Submissions
Best Solutions
Point Value: 10 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Dec 28, 2008
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
didn't know that XD
completely hacked XD
But I have to update that manually, so sometimes scores might be over 10.
It will be the same - (B / Y)2.