#P10457. Poker Card Divination
Poker Card Divination
Poker Card Divination
Lyd has learned a DIY divination method using a deck of playing cards. The process is as follows:
A standard deck without jokers (52 cards) is shuffled and divided equally into 13 piles (numbered 1 to 13), each pile having 4 cards. Pile 13 is called the "life pile" which gives you 4 lives. Among these cards, the 4 Kings (K) are called the death cards.
Initially, all cards are placed face down.
The divination is performed by the following steps:
- Start a new cycle by drawing the top card from the life pile (pile 13).
- Flip the drawn card face up. If its rank is not K, place it face up on the top of the pile corresponding to its number. The mapping is as follows: [ A \to 1, \quad 2 \to 2, \quad 3 \to 3, \quad \ldots, \quad 10 \to 10, \quad J \to 11, \quad Q \to 12. ] (Note: If the card is K then it is a death card.)
- After placing a card (if it is not K), from that same pile (where the card was just placed) draw the bottom card (i.e. the last card of that pile), flip it face up, and then place it on top of the pile corresponding to its rank (using the same mapping as above). Let the target pile be the new current pile and repeat step 3.
- If at any moment the drawn card is a K, it is discarded (and not placed on any pile), a life is lost, and the current cycle ends. Then restart a new cycle by going back to step 1.
- The divination stops when all four lives are lost (i.e. when four death cards have been drawn).
After the process, for each pile, look at the top card. Only the cards that are face up are considered. For every rank (except K) that appears exactly four times (i.e. four piles have a top card of the same rank), we say that a "pair" has been opened. Based on the total number of pairs opened, the divination result is determined as follows:
- 0 pairs: "extremely ominous"
- 1 to 2 pairs: "great misfortune"
- 3 pairs: "misfortune"
- 4 to 5 pairs: "minor misfortune"
- 6 pairs: "moderate fortune"
- 7 to 8 pairs: "minor auspicious"
- 9 pairs: "auspicious"
- 10 to 11 pairs: "great auspicious"
- 12 pairs: "full bloom, extremely auspicious"
Note: All formulas are given in LaTeX format. Refer to the sample test cases if you need further clarification.
inputFormat
The input begins with an integer T (T ≥ 1) — the number of test cases. For each test case, there are 13 lines describing the 13 piles. The i-th line (1 ≤ i ≤ 13) contains 4 space‐separated card ranks representing the i-th pile from top to bottom. Each card is one of the following: A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K. Note that pile 13 is the life pile.
outputFormat
For each test case, output a single line containing the divination result, which is one of the following strings:
• extremely ominous • great misfortune • misfortune • minor misfortune • moderate fortune • minor auspicious • auspicious • great auspicious • full bloom, extremely auspicious
sample
1
A 2 3 4
5 6 7 8
9 10 J Q
A 2 3 4
5 6 7 8
9 10 J Q
A 2 3 4
5 6 7 8
9 10 J Q
A 2 3 4
5 6 7 8
9 10 J Q
K K K K
extremely ominous