ody
The Poker Series由许多定义良好的简短函数组成,当它们组合在一起时将导致复杂的行为。我们的目标是创建一个函数,该函数将采用两种手矩阵(下面定义)并返回获胜的手。
手牌矩阵是4x13的二进制矩阵,显示扑克玩家可以使用的牌。这个程序将扩展到使用5张牌手52张牌手!套装的西装都同样排名,所以它们只能确定冲洗(和直冲洗)。
对于每个挑战,您都可以随意重用本系列中以前挑战中的解决方案。金宝搏官方网站为了将这个问题分解成更小的部分,我可能会做出速度不是最优的架构选择。这是作为编码的练习。这个项目的更大目标可能会更快地完成,但更模糊的方式。
--------
A对是2张同等级(列)的牌和三个罚球。Ace(第一列)是最高的。列代表一个,2,3,... K.接下来的三张最高卡是踢球者。如果踢球者也形成一对或三种类型,则仍然被认为是该功能的目的。
This hand matrix:
0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
represents a pair, so the return value from the function is TRUE.
This hand matrix does not:
0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
so the return value should be FALSE.
This hand matrix does represent a pair
0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0
Remember, hand matrices can contain any number of 1's from 0 to 52.
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0
Would be TRUE for this function.
A second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand matrix, but it only shows the cards used to make the pair. If more than one pair can be made, return the higher ranking one (the one with the highest rank. Ace being the highest). If different suits are possible for the same pair, return the one higher up in the matrix, same for kickers. If the pair happens to also be a four of a kind or full house, two pair, etc.. it still meets the defintion and should be returned.
解决方案48626.
@@ bmtran:d .....这个解决方案在这个测试案例中失败了…%%HM = [0 1 0 0 0 0 0 0 0 0 0 0 10 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0;
当我使用代码的最佳扑克手问题时发现了...欢呼声。
寄生号
255个求解器
回到基础4 -搜索路径
331个议员
矢量化整数的数字
277个求解器
按升序安排矢量
649个议员
检查向量中是否存在数
5826个求解器
这是一个有效的tic tac toe状态吗?
106个议员
扑克系列05:isstraight
解决57
获得组合的排名
40个求解器
从矩阵中获取行和列位置
250个议员
实现简单的旋转密码
解决993
找到Matlab Central中的宝藏,并发现社区如何帮助您!
选择一个网站,以便在可用的地方进行翻译的内容,并查看本地活动和优惠。根据您的位置,我们建议您选择:。
你也可以从以下列表中选择一个网站:
选择中国网站(以中文或英文)以获取最佳网站性能。其他MathWorks国家网站未优化您的位置。
联系您当地的办公室