Skip to content

Commit

Permalink
重构
Browse files Browse the repository at this point in the history
  • Loading branch information
EndlessCheng committed Jul 14, 2019
1 parent e19610c commit 8fbdeae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
6 changes: 5 additions & 1 deletion analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ func analysisPlayerWithRisk(playerInfo *model.PlayerInfo, mixedRiskTable riskTab
printResults14WithRisk(results14, mixedRiskTable)
printResults14WithRisk(incShantenResults14, mixedRiskTable)
default:
return fmt.Errorf("参数错误: %d 张牌", countOfTiles)
err := fmt.Errorf("参数错误: %d 张牌", countOfTiles)
if debugMode {
panic(err)
}
return err
}

fmt.Println()
Expand Down
22 changes: 7 additions & 15 deletions core.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,6 @@ func (d *roundData) analysis() error {
currentRoundCache.addAIDiscardTileWhenDrawTile(bestAttackDiscardTile, bestDefenceDiscardTile, bestAttackDiscardTileRisk, bestDefenceDiscardTileRisk)
}

if debugMode {
if handsCount := util.CountOfTiles34(d.counts); handsCount%3 != 2 {
return fmt.Errorf("手牌错误:%d 张牌 %v", handsCount, d.counts)
}
}

if d.skipOutput {
return nil
}
Expand Down Expand Up @@ -797,20 +791,14 @@ func (d *roundData) analysis() error {
}
}

if debugMode {
if handsCount := util.CountOfTiles34(d.counts); handsCount%3 != 1 {
return fmt.Errorf("手牌错误:%d 张牌 %v", handsCount, d.counts)
}
}

if d.skipOutput {
return nil
}

// 上家舍牌时若无法鸣牌则跳过显示
if d.gameMode == gameModeMatch && who == 3 && !canBeMeld {
return nil
}
//if d.gameMode == gameModeMatch && who == 3 && !canBeMeld {
// return nil
//}

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

if d.gameMode == gameModeMatch && !canBeMeld {
return nil
}

// 为了方便解析牌谱,这里尽可能地解析副露
// TODO: 提醒: 消除海底/避免河底/型听
// FIXME: 最后一张牌是无法鸣牌的
Expand Down

0 comments on commit 8fbdeae

Please sign in to comment.