Skip to content

Commit 8fbdeae

Browse files
committed
重构
1 parent e19610c commit 8fbdeae

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

analysis.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ func analysisPlayerWithRisk(playerInfo *model.PlayerInfo, mixedRiskTable riskTab
8383
printResults14WithRisk(results14, mixedRiskTable)
8484
printResults14WithRisk(incShantenResults14, mixedRiskTable)
8585
default:
86-
return fmt.Errorf("参数错误: %d 张牌", countOfTiles)
86+
err := fmt.Errorf("参数错误: %d 张牌", countOfTiles)
87+
if debugMode {
88+
panic(err)
89+
}
90+
return err
8791
}
8892

8993
fmt.Println()

core.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -666,12 +666,6 @@ func (d *roundData) analysis() error {
666666
currentRoundCache.addAIDiscardTileWhenDrawTile(bestAttackDiscardTile, bestDefenceDiscardTile, bestAttackDiscardTileRisk, bestDefenceDiscardTileRisk)
667667
}
668668

669-
if debugMode {
670-
if handsCount := util.CountOfTiles34(d.counts); handsCount%3 != 2 {
671-
return fmt.Errorf("手牌错误:%d 张牌 %v", handsCount, d.counts)
672-
}
673-
}
674-
675669
if d.skipOutput {
676670
return nil
677671
}
@@ -797,20 +791,14 @@ func (d *roundData) analysis() error {
797791
}
798792
}
799793

800-
if debugMode {
801-
if handsCount := util.CountOfTiles34(d.counts); handsCount%3 != 1 {
802-
return fmt.Errorf("手牌错误:%d 张牌 %v", handsCount, d.counts)
803-
}
804-
}
805-
806794
if d.skipOutput {
807795
return nil
808796
}
809797

810798
// 上家舍牌时若无法鸣牌则跳过显示
811-
if d.gameMode == gameModeMatch && who == 3 && !canBeMeld {
812-
return nil
813-
}
799+
//if d.gameMode == gameModeMatch && who == 3 && !canBeMeld {
800+
// return nil
801+
//}
814802

815803
if !debugMode {
816804
clearConsole()
@@ -826,6 +814,10 @@ func (d *roundData) analysis() error {
826814
fmt.Println()
827815
riskTables.printWithHands(d.counts, d.leftCounts)
828816

817+
if d.gameMode == gameModeMatch && !canBeMeld {
818+
return nil
819+
}
820+
829821
// 为了方便解析牌谱,这里尽可能地解析副露
830822
// TODO: 提醒: 消除海底/避免河底/型听
831823
// FIXME: 最后一张牌是无法鸣牌的

0 commit comments

Comments
 (0)