chore(i8n,learn): processed translations
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
15047f2d90
commit
e5c44a3ae5
@@ -1,25 +1,64 @@
|
||||
---
|
||||
id: 5900f3a21000cf542c50feb5
|
||||
title: 问题54:扑克手
|
||||
title: 'Problem 54: Poker hands'
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
forumTopicId: 302165
|
||||
dashedName: problem-54-poker-hands
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
在纸牌游戏扑克牌中,一手牌由五张牌组成,并按以下方式从最低到最高排名:高牌:最高价值牌。一对:两张价值相同的牌。两对:两对不同。三种类型:三张相同价值的牌。直:所有卡都是连续值。同花顺:同一套牌的所有牌。满屋:三种和一对。四种:四张相同价值的牌。同花顺:所有牌都是同一套牌的连续值。皇家同花顺:十,杰克,女王,国王,王牌,同样的诉讼。卡的价值依次为:2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace。如果两个玩家拥有相同的排名牌,则排名由最高值赢得;例如,一对八个击打一对五(见下面的例子1)。但是,如果两个级别相关,例如,两个玩家都有一对皇后,则比较每手牌中的最高牌数(参见下面的例子4);如果最高牌结合,则比较下一张最高牌,依此类推。考虑以下五手交给两名球员:
|
||||
In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way:
|
||||
|
||||
手牌1球员2冠军1 5H 5C 6S 7S KDPair of Fives 2C 3S 8S 8D TDPair of Eights Player 2 2 5D 8C 9S JS ACHighest card Ace 2C 5C 7D 8S QHHighest card Queen Player 1 3 2D 9C AS AH ACThree Aces 3D 6D 7D TD QDFlush与钻石玩家2 4 4D 6S 9H QH QCPair of Queens最高卡九3D 6D 7H QD QSPair皇后最高卡七人玩家1 5 2H 2D 4C 4D 4SFull HouseWith Three Fours 3C 3D 3S 9S 9DFull Housewith Three Threes Player 1
|
||||
<ul>
|
||||
<li>High Card: Highest value card.</li>
|
||||
<li>One Pair: Two cards of the same value.</li>
|
||||
<li>Two Pairs: Two different pairs.</li>
|
||||
<li>Three of a Kind: Three cards of the same value.</li>
|
||||
<li>Straight: All cards are consecutive values.</li>
|
||||
<li>Flush: All cards of the same suit.</li>
|
||||
<li>Full House: Three of a kind and a pair.</li>
|
||||
<li>Four of a Kind: Four cards of the same value.</li>
|
||||
<li>Straight Flush: All cards are consecutive values of same suit.</li>
|
||||
<li>Royal Flush: Ten, Jack, Queen, King, Ace, in same suit.</li>
|
||||
</ul>
|
||||
|
||||
文件poker.txt包含一千个随机发给两个玩家的牌。该文件的每一行包含十张牌(由一个空格分隔):前五张是Player 1的牌,后五张是Player 2的牌。你可以假设所有的牌都是有效的(没有无效的角色或重复的牌),每个牌手的牌都没有特定的顺序,而且每手牌都有明显的赢家。玩家1赢了多少手牌?
|
||||
The cards are valued in the order: 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.
|
||||
|
||||
If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.
|
||||
|
||||
Consider the following five hands dealt to two players:
|
||||
|
||||
| Hand | Player 1 | Player 2 | Winner |
|
||||
| ------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------- |
|
||||
| <strong>1</strong> | 5H 5C 6S 7S KD <br> Pair of Fives | 2C 3S 8S 8D TD <br> Pair of Eights | Player 2 |
|
||||
| <strong>2</strong> | 5D 8C 9S JS AC <br> Highest card Ace | 2C 5C 7D 8S QH <br> Highest card Queen | Player 1 |
|
||||
| <strong>3</strong> | 2D 9C AS AH AC <br> Three Aces | 3D 6D 7D TD QD <br> Flush with Diamonds | Player 2 |
|
||||
| <strong>4</strong> | 4D 6S 9H QH QC <br> Pair of Queens <br> Highest card Nine | 3D 6D 7H QD QS <br> Pair of Queens <br> Highest card Seven | Player 1 |
|
||||
| <strong>5</strong> | 2H 2D 4C 4D 4S <br> Full House <br> with Three Fours | 3C 3D 3S 9S 9D <br> Full House <br> with Three Threes | Player 1 |
|
||||
|
||||
The global array (`handsArr`) passed to the function, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner.
|
||||
|
||||
How many hands does Player 1 win?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler54()`应该返回376。
|
||||
`pokerHands(testArr)` should return a number.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler54(), 376);
|
||||
assert(typeof pokerHands(testArr) === 'number');
|
||||
```
|
||||
|
||||
`pokerHands(testArr)` should return 2.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pokerHands(testArr), 2);
|
||||
```
|
||||
|
||||
`pokerHands(handsArr)` should return 376.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pokerHands(handsArr), 376);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
Reference in New Issue
Block a user