问题标签 [mahjong]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
algorithm - 麻将赢手算法
我正在寻找一种算法来确定当前的麻将手是否是赢家。如果你不熟悉游戏,这里是基本的想法(简化):
- 共有三组瓷砖,每组包含排名 1-9 的瓷砖。还有特殊的瓷砖,共有七种。每张牌有四个副本,因此每种花色有 36 张牌和 28 种特殊牌。
- 一只手有 14 张牌。
- chow是一组三个连续等级的单一花色的牌。
- 乒乓球是一组三个相同的瓷砖。
- 杠是一组四张相同的牌。
- 一对是一组两个相同的瓷砖。
- 获胜手牌是其中的牌形成任意数量的 chow、pongs 和/或 kongs 和一对。
手按花色排序,然后按等级排序。我的想法是这样的:
- 将所有图块标记为未访问且未中奖。
- 访问第一个未访问的图块。
- 检查随后的牌,直到遇到吃、碰或杠,或者直到没有可能。如果组合完成,将所有参与的瓷砖标记为已访问并获胜
- 如果所有的牌都被访问过,检查它们是否都赢了。如果不是所有的图块都被访问过,请转到 2。
问题是,一旦牌是组合的一部分,就不能成为任何其他组合的成员,这可能会使这手牌成为赢家。
关于工作算法的任何想法?
mahjong - 识别获胜的麻将手
我正在努力找出麻将中的获胜手,有没有人有任何提示或有效的公式?
麻将游戏就像杜松子酒,有 13 张牌,4,3 套或 3 套同花。获胜的手包括被盗或给的牌,总共 14 张牌。获胜的手是一组:
- 3套4加1对
- 4 套 3 加 1 对。
- 2套4加2套3,不成对。
- 同花顺是 3 套,但所有一套套房都是额外的。
- 所有对也是一种选择。
也有与此相关的点。
任何指导或帮助将不胜感激。跟进并添加信息,这可能对其他人有所帮助,并帮助我们回答我们自己的问题,
我的目标是香港麻将规则。当我通过一种算法工作时,我正在研究的是删除街道,如果失败,删除集合。
有任何想法吗?c++ - 任何人都有确定麻将游戏是否获胜的算法?
我正在阅读一些中国古代游戏麻将的介绍(有点像扑克,但要复杂得多)。我花了几天时间编写一个程序来确定给定的手牌是否是赢牌。有谁知道或知道我在哪里可以找到免费代码?我只需要确定输赢的部分,我不是在寻找整个项目。谢谢。
arrays - What is the best way to store the data for a Mahjong tile set?
I am planning a kids' version of Mahjong Solitaire (starting with just the Turtle board layout and working my way from there). I am trying to wrap my head around how to store the data for each layer of the Turtle layout tileset. See here for an example: http://icarus.cs.weber.edu/~dab/cs3230/labs/lab.5/tile_layers.pdf
Ordinarily I'd use a 2D array for each layer, and a 1D array of the layers, from 0 (bottom-most) to 4 (topmost), with the allowance for layers above that (5, 6, ...). However, there are the tiles that occupy more than one row and/or column at once. For example, in Layer 0 (bottom-most), the far left tile and the 2 far right tiles occupy two rows at once, and the single tile in Layer 4 (topmost) occupies two columns and two rows at the same time.
What is the best data model to store this sort of tileset? Should each tile have a flag for shifting it halfway into the next row and column?
I'm thinking, there is a Tile
object, each instance of which represents 1 of the 144 tiles on the board. Then all tiles are arranged in layers as I described above (2D array for each layer, all layers stored in a 1D array).
Note: I am considering using Javascript & HTML5 for this project. It won't be something I release to the public, just a programming exercise.
Is this the best method? Am I missing something?
java - 反编译的.class文件,btyecode版本
我正在尝试运行从网上获取的源代码。问题显示反编译的 .class 文件,字节码版本:46.0(java1.3 或更早版本)