Skip to content

Commit

Permalink
修复暗杠九莲的问题 (#13)
Browse files Browse the repository at this point in the history
* 修复暗杠九莲的问题

* 升级版本号
  • Loading branch information
ssttkkl authored Feb 19, 2024
1 parent fb48f52 commit 60af138
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kotlin.code.style=official

group=io.github.ssttkkl
version=0.6.2
version=0.6.3

org.gradle.jvmargs=-Xmx8g -Xms1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ internal fun sushiSeriesCheckerFactory(windKotsuCount: Int, windJyantou: Boolean
*/
internal fun churenSeriesCheckerFactory(nineWaiting: Boolean): YakuChecker {
return YakuChecker { pattern ->
if (pattern !is RegularHoraHandPattern) {
if (pattern !is RegularHoraHandPattern || pattern.furo.isNotEmpty()) {
return@YakuChecker false
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package mahjongutils.yaku

import mahjongutils.models.Furo
import mahjongutils.models.Mentsu
import mahjongutils.models.Tatsu
import mahjongutils.models.Tile
import mahjongutils.hora.KokushiHoraHandPattern
import mahjongutils.models.hand.RegularHandPattern
import mahjongutils.hora.RegularHoraHandPattern
import mahjongutils.yaku.Yakus
import mahjongutils.models.*
import kotlin.test.Test
import kotlin.test.assertFails

internal class TestYakuman {
@Test
Expand Down Expand Up @@ -128,6 +125,46 @@ internal class TestYakuman {
tester(pattern, setOf(Yakus.ChurenNineWaiting))
}

@Test
fun testChurenShouldFails() {
val pattern = RegularHoraHandPattern(
RegularHandPattern(
k = 4,
jyantou = Tile.get("8s"),
menzenMentsu = listOf(Mentsu("111s"), Mentsu("234s"), Mentsu("567s")),
furo = listOf(Furo("0990s")),
tatsu = emptyList(),
remaining = emptyList()
),
agari = Tile.get("8s"),
agariTatsu = null,
tsumo = false
)
val pattern2 = RegularHoraHandPattern(
RegularHandPattern(
k = 4,
jyantou = Tile.get("8s"),
menzenMentsu = listOf(Mentsu("111s"), Mentsu("234s"), Mentsu("567s")),
furo = listOf(Furo("0990s")),
tatsu = emptyList(),
remaining = emptyList()
),
agari = Tile.get("7s"),
agariTatsu = Tatsu("56s"),
tsumo = false
)

assertFails {
tester(pattern, setOf(Yakus.Churen))
tester(pattern, setOf(Yakus.ChurenNineWaiting))
}

assertFails {
tester(pattern2, setOf(Yakus.Churen))
tester(pattern2, setOf(Yakus.ChurenNineWaiting))
}
}

@Test
fun testDaisushi_Tsuiso() {
val pattern = RegularHoraHandPattern(
Expand Down

0 comments on commit 60af138

Please sign in to comment.