0% found this document useful (0 votes)
5 views

int-programming

The document outlines the rules and strategy for the card game Agram, played between two players using a standard 52-card deck. The dealer must follow specific rules to determine which card to play based on the opponent's lead card, prioritizing suit and value. Sample input and output are provided to illustrate the game's mechanics.

Uploaded by

CK
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

int-programming

The document outlines the rules and strategy for the card game Agram, played between two players using a standard 52-card deck. The dealer must follow specific rules to determine which card to play based on the opponent's lead card, prioritizing suit and value. Sample input and output are provided to illustrate the game's mechanics.

Uploaded by

CK
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ACSL

American Computer Science League


2016-2017 Contest 1
ACSL Agram
Intermediate Division

PROBLEM: Agram is a card game for 2 players, using the cards from a standard 52-card pack.

The dealer deals five cards to each player. The opponent player leads any card, playing it face up
in the middle of the playing area. The following strategy will be used to determine which card
the dealer will play:

• The dealer must play a card of the same suit if he can.

• He plays the lowest card in that suit that is of a higher value than the
card the opponent played.

• If he does not have such a card, he plays his lowest card in that suit.

• If he does not have a card in that suit, he plays the lowest value card
regardless of suit. We guarantee there will be no ties.

INPUT: There will be 5 lines of input. Each line will contain the opponent’s lead card and the
5 cards held by the dealer. All cards will be represented by 2-character strings in value-suit
order. AH represents the ace of hearts. K, Q and J and T will be used for king, queen, jack and
10 respectively. Note that the ace in this game has the lowest rank.

OUTPUT: For each input line, print the card the dealer must play according to the strategy
listed above.

SAMPLE INPUT: SAMPLE OUTPUT:

1. 5D, 2D, 6H, 9D, TD, 6H 1. 9D

2. TC, AC, KC, QH, JS, TD 2. KC

3. 3D, 4H, 5C, 6S, 2D, 7H 3. 2D

4. KS, TH, QC, 7H, 9H, 3H 4. 3H

5. AC, AD, KH, JS, KS, QS 5. AD


ACSL
American Computer Science League
2016-2017 Contest 1
ACSL Agram
Intermediate Division

TEST DATA

TEST INPUT TEST OUTPUT

1. 6H, 2H, 4C, 7H, 9D, 6S 1. 7H

2. AC, 2S, 5D, 6H, JS, 3S 2. 2S

3. KD, 4S, 4C, 4S, 4D, KS 3. 4D

4. QS, 4D, 7C, 8D, TH, 2C 4. 2C

5. TC, KC, 5H, AD, 7C, TS 5. KC

You might also like