public static double calc(List <int> input, List <int> guiCard) { List <int> cards = new List <int>(); for (int i = 0; i < MaJiangDef.MAX_NUM; i++) { cards.Add(0); } foreach (int c in input) { cards[c - 1] = cards[c - 1] + 1; } int guiNum = 0; foreach (int gui in guiCard) { guiNum += cards[gui - 1]; cards[gui - 1] = 0; } List <int> ting = HuUtil.isTingCard(cards, guiNum); if (ting.Count != 0) { return(ting.Count * 10); } long wan_key = 0; long tong_key = 0; long tiao_key = 0; long feng_key = 0; long jian_key = 0; for (int i = MaJiangDef.WAN1; i <= MaJiangDef.WAN9; i++) { int num = cards[i - 1]; wan_key = wan_key * 10 + num; } for (int i = MaJiangDef.TONG1; i <= MaJiangDef.TONG9; i++) { int num = cards[i - 1]; tong_key = tong_key * 10 + num; } for (int i = MaJiangDef.TIAO1; i <= MaJiangDef.TIAO9; i++) { int num = cards[i - 1]; tiao_key = tiao_key * 10 + num; } for (int i = MaJiangDef.FENG_DONG; i <= MaJiangDef.FENG_BEI; i++) { int num = cards[i - 1]; feng_key = feng_key * 10 + num; } for (int i = MaJiangDef.JIAN_ZHONG; i <= MaJiangDef.JIAN_BAI; i++) { int num = cards[i - 1]; jian_key = jian_key * 10 + num; } List <List <AITableInfo> > tmp = new List <List <AITableInfo> >(); List <AITableInfo> wanAITableInfo = AITable.table[wan_key]; tmp.Add(wanAITableInfo); List <AITableInfo> tongAITableInfo = AITable.table[tong_key]; tmp.Add(tongAITableInfo); List <AITableInfo> tiaoAITableInfo = AITable.table[tiao_key]; tmp.Add(tiaoAITableInfo); List <AITableInfo> fengAITableInfo = AITableFeng.table[feng_key]; tmp.Add(fengAITableInfo); List <AITableInfo> jianAITableInfo = AITableJian.table[jian_key]; tmp.Add(jianAITableInfo); List <double> ret = new List <double>(); calcAITableInfo(ret, tmp, 0, false, 0.0d); double result = 0.0d; foreach (double d in ret) { if (d > result) { result = d; } } return(result); }
public static double calc(List <int> input, List <int> guiCard, int[] remainCards) { List <int> cards = new List <int>(); for (int i = 0; i < MaJiangDef.MAX_NUM; i++) { cards.Add(0); } foreach (int c in input) { cards[c - 1] = cards[c - 1] + 1; } int guiNum = 0; foreach (int gui in guiCard) { guiNum += cards[gui - 1]; cards[gui - 1] = 0; } List <int> ting = HuUtil.isTingCard(cards, guiNum); if (ting.Count != 0) { return(ting.Count * 10); } long wan_key = 0; long tong_key = 0; long tiao_key = 0; long feng_key = 0; long jian_key = 0; for (int i = MaJiangDef.WAN1; i <= MaJiangDef.WAN9; i++) { int num = cards[i - 1]; wan_key = wan_key * 10 + num; } for (int i = MaJiangDef.TONG1; i <= MaJiangDef.TONG9; i++) { int num = cards[i - 1]; tong_key = tong_key * 10 + num; } for (int i = MaJiangDef.TIAO1; i <= MaJiangDef.TIAO9; i++) { int num = cards[i - 1]; tiao_key = tiao_key * 10 + num; } for (int i = MaJiangDef.FENG_DONG; i <= MaJiangDef.FENG_BEI; i++) { int num = cards[i - 1]; feng_key = feng_key * 10 + num; } for (int i = MaJiangDef.JIAN_ZHONG; i <= MaJiangDef.JIAN_BAI; i++) { int num = cards[i - 1]; jian_key = jian_key * 10 + num; } AIProperty property; property.N = 9; property.baseP = 36.0d / 136; property.huLian = true; List <List <AITableInfo> > dynamicMaxPossible = new List <List <AITableInfo> >(); property.tileType = MaJiangDef.WAN1; List <AITableInfo> dynamicWanAITableInfo = getAITable(wan_key, _everyNormalCards, property, remainCards); dynamicMaxPossible.Add(dynamicWanAITableInfo); property.tileType = MaJiangDef.TONG1; List <AITableInfo> dynamicTongAITableInfo = getAITable(tong_key, _everyNormalCards, property, remainCards); dynamicMaxPossible.Add(dynamicTongAITableInfo); property.tileType = MaJiangDef.TIAO1; List <AITableInfo> dynamicTiaoAITableInfo = getAITable(tiao_key, _everyNormalCards, property, remainCards); dynamicMaxPossible.Add(dynamicTiaoAITableInfo); property.N = 4; property.baseP = 16.0d / 136; property.huLian = false; property.tileType = MaJiangDef.FENG_DONG; List <AITableInfo> dynamicFengAITableInfo = getAITable(feng_key, _everyFengCards, property, remainCards); dynamicMaxPossible.Add(dynamicFengAITableInfo); property.N = 3; property.baseP = 12.0d / 136; property.huLian = false; property.tileType = MaJiangDef.JIAN_ZHONG; List <AITableInfo> dynamicJianAITableInfo = getAITable(jian_key, _everyJianCards, property, remainCards); dynamicMaxPossible.Add(dynamicJianAITableInfo); List <double> ret = new List <double>(); calcAITableInfo(ret, dynamicMaxPossible, 0, false, 0.0d); double result = 0.0d; foreach (double d in ret) { if (d > result) { result = d; } } return(result); }