Exemple #1
0
        public CompletedHand ChoiceCompletedHand(TileType newTileInHand, TileType ownWind, TileType roundWind,
                                                 Player?ronTarget,
                                                 bool riichi,
                                                 bool doubleRiichi,
                                                 bool openRiichi,
                                                 bool 一発,
                                                 bool 嶺上,
                                                 bool 海底,
                                                 bool 河底,
                                                 bool 天和,
                                                 bool 地和,
                                                 bool 人和,
                                                 TileType[] doraTiles,
                                                 TileType[] uraDoraTiles,
                                                 bool 槍槓,
                                                 Rules.HandCap handCap)
        {
            var result = (score : int.MinValue, completed : default(CompletedHand));

            foreach (var it in structures)
            {
                var item = new CompletedHand(it, newTileInHand, ownWind: ownWind, roundWind: roundWind,
                                             ronTarget: ronTarget,
                                             riichi: riichi,
                                             doubleRiichi: doubleRiichi,
                                             openRiichi: openRiichi,
                                             一発: 一発,
                                             嶺上: 嶺上,
                                             海底: 海底,
                                             河底: 河底,
                                             天和: 天和,
                                             地和: 地和,
                                             人和: 人和,
                                             槍槓: 槍槓,
                                             doraTiles: doraTiles,
                                             uraDoraTiles: uraDoraTiles);
                if (result.score < item.基本点(handCap).score)
                {
                    result = (item.基本点(handCap).score, item);
                }
            }

            return(result.completed);
        }
Exemple #2
0
        readonly public (ScoreType?type, int score) 基本点(Rules.HandCap handCap)
        {
            int maxYakumanCount;

            switch (handCap)
            {
            case Rules.HandCap.役満:
                maxYakumanCount = 1;
                break;

            case Rules.HandCap.ダブル役満:
                maxYakumanCount = 2;
                break;

            case Rules.HandCap.トリプル役満:
                maxYakumanCount = 3;
                break;

            default:
                throw new System.ArgumentException(handCap.ToString());
            }

            var yakumanCount = Mathf.Min(役満.Values.Sum(), maxYakumanCount);

            if (yakumanCount == 1)
            {
                return(ScoreType.役満, 8000);
            }
            else if (yakumanCount == 2)
            {
                return(ScoreType.ダブル役満, 16000);
            }
            else if (yakumanCount > 2)
            {
                return(ScoreType.トリプル役満, 24000);
            }

            var han = Han;

            if (han == 5)
            {
                return(ScoreType.満貫, 2000);
            }
            if (han >= 6 && han <= 7)
            {
                return(ScoreType.跳満, 3000);
            }
            if (han >= 8 && han <= 10)
            {
                return(ScoreType.満, 4000);
            }
            if (han >= 11 && han <= 12)
            {
                return(ScoreType.満, 6000);
            }
            if (han >= 13)
            {
                return(ScoreType.数え役満, 8000);
            }

            var fu = Fu;

            var value = fu * (1 << (han + 2));

            if (value < 2000)
            {
                return(null, value);
            }
            else
            {
                return(ScoreType.満貫, 2000);
            }
        }