master
fpgajie 2026-01-08 19:43:31 +08:00
parent 08d8666e50
commit 57d4a95603
10 changed files with 119 additions and 34 deletions

Binary file not shown.

View File

@ -297,6 +297,17 @@ public class HuNanChangSha {
int id = firstTip.getInt("id");
int weight = firstTip.getInt("weight");
card = firstTip.getInt("card");
if (type == 6){
params.putString("session", session + "," + token);
params.putInt("qi", 0);
params.putInt("id", id);
client.send("612", params, response -> {
});
return "胡牌";
}
if ((type == 5 || type == 3 || type==4)&&weight==4) {
//判断开杠后是否能下听
List<Integer> gangusecars = new ArrayList<>();
@ -309,6 +320,20 @@ public class HuNanChangSha {
if (shifoutingpai3.size() > 0) {
//开杠
//判断是否杠了之后没有牌可以听
List<Integer> allList = new ArrayList<>();
allList.addAll(changShaCardInhand);
allList.addAll(changShachuguopai);
int jutingnum = changShaSuanFaTest.getTingPainum(shifoutingpai3,allList);
if (jutingnum==0){
params.putString("session", session + "," + token);
params.putInt("qi", 0);
params.putInt("id", 0);
client.send("612", params, response -> {
});
return "不开杠";
}
Util.removeCard(changShaCardInhand,card,3);
params.putString("session", session + "," + token);
params.putInt("qi", 0);
@ -327,11 +352,29 @@ public class HuNanChangSha {
}
if (type == 4) {
// Util.removeCard(changShaCardInhand,card,4);
Util.removeCard(gangusecars,card,4);
List<Integer> shifoutingpai4 = changShaSuanFaTest.handscardshifoutingpai(gangusecars,chowGroup,pongGroup,gangdepai);
if (shifoutingpai4.size() > 0) {
//开杠
//判断是否杠了之后没有牌可以听
List<Integer> allList = new ArrayList<>();
allList.addAll(changShaCardInhand);
allList.addAll(changShachuguopai);
int jutingnum = changShaSuanFaTest.getTingPainum(shifoutingpai4,allList);
if (jutingnum==0){
params.putString("session", session + "," + token);
params.putInt("qi", 0);
params.putInt("id", 0);
client.send("612", params, response -> {
});
return "不开杠";
}
Util.removeCard(changShaCardInhand,card,4);
params.putString("session", session + "," + token);
params.putInt("qi", 0);
@ -355,6 +398,21 @@ public class HuNanChangSha {
List<Integer> shifoutingpai5 = changShaSuanFaTest.handscardshifoutingpai(gangusecars,chowGroup,pongGroup,gangdepai);
if (shifoutingpai5.size() > 0) {
//开杠
//判断是否杠了之后没有牌可以听
List<Integer> allList = new ArrayList<>();
allList.addAll(changShaCardInhand);
allList.addAll(changShachuguopai);
int jutingnum = changShaSuanFaTest.getTingPainum(shifoutingpai5,allList);
if (jutingnum==0){
params.putString("session", session + "," + token);
params.putInt("qi", 0);
params.putInt("id", 0);
client.send("612", params, response -> {
});
return "不开杠";
}
Util.removeCard(changShaCardInhand,card,1);
params.putString("session", session + "," + token);
params.putInt("qi", 0);

View File

@ -1298,18 +1298,18 @@ public class JiQiRens {
//
//重连
if ("22".equalsIgnoreCase(wanfaId)) { //湖南红中麻将
client = new TaurusClient("8.138.242.190:6421", "game", TaurusClient.ConnectionProtocol.Tcp);
}
if ("10".equalsIgnoreCase(wanfaId)) {
client = new TaurusClient("127.0.0.1:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
}
// if ("22".equalsIgnoreCase(wanfaId)) { //湖南红中麻将
// client = new TaurusClient("8.138.242.190:6421", "game", TaurusClient.ConnectionProtocol.Tcp);
// }
//
if ("66".equalsIgnoreCase(wanfaId)) {
client = new TaurusClient("8.138.242.190:6841", "game", TaurusClient.ConnectionProtocol.Tcp);
}
client.connect();
// if ("10".equalsIgnoreCase(wanfaId)) {
// client = new TaurusClient("127.0.0.1:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
// }
////
// if ("66".equalsIgnoreCase(wanfaId)) {
// client = new TaurusClient("8.138.242.190:6841", "game", TaurusClient.ConnectionProtocol.Tcp);
// }
// client.connect();
}
}

View File

@ -169,6 +169,7 @@ public class ChangShaSuanFaTest {
int caozuonum = 0;
List<Integer> tmpres = new ArrayList<>();
tmpres.addAll(resultList);
tmpres.addAll(cardInhand);
for (Map.Entry<Integer, List<Integer>> entry : afterOp.entrySet()) {
if (caozuonum==0){
caozuonum = getTingPainum(entry.getValue(),tmpres);
@ -492,22 +493,33 @@ public class ChangShaSuanFaTest {
//调平胡递归
List<Integer> integers = ChangshaWinSplitCard.analyzeBestDiscard(pinghuhandCards);
Integer integer = 0;
int integer = 0;
integer = selectBestCardByPriority(integers);
Map<String, List<Integer>> mapduijiang = new HashMap<>();
System.out.println(pinghuhandCards);
int duijiangnum = checkduijiang(pinghuhandCards);
System.out.println("mapduijiang:"+duijiangnum);
if (integers.size()>1){
if (integers.size()>1&&duijiangnum==0){
integer = selectBestCardRemove258(integers);
}
//判断是否可以开杠
int cardnum = 0;
if (integer>0){
cardnum = Util.cardNum(integer,cardInhand);
}
if (integers.size() > 0) {
if (integers.size() > 0&&cardnum<4) {
System.out.println("平胡最新出牌策略=============================================== 666 " + integer);
return String.valueOf(integer);
}
//先拆对子
//再拆门子
@ -614,6 +626,8 @@ public class ChangShaSuanFaTest {
System.out.println("258将牌: " + is258Cards);
System.out.println("非258牌: " + non258Cards);
// 优先从非258牌中选
if (!non258Cards.isEmpty()) {
return selectBestSingleCard(non258Cards);
@ -4408,6 +4422,12 @@ public class ChangShaSuanFaTest {
return chiob;
}
public static boolean shiFouJieTing(List<Integer> tingList,List<Integer> changShachuguopai ){
return false;
}
public static int getTingPainum(List<Integer> caozq, List<Integer> changShachuguopai){
int num = 0;
for (int i=0;i<caozq.size();i++){
@ -4422,6 +4442,8 @@ public class ChangShaSuanFaTest {
return num;
}
/**
*
* @param cardhand
@ -4577,20 +4599,20 @@ public class ChangShaSuanFaTest {
test1.add(208);
test1.add(208);
test1.add(208);
test1.add(201);
test1.add(202);
test1.add(202);
test1.add(201);
test1.add(108);
test1.add(107);
test1.add(202);
test1.add(109);
test1.add(109);
test1.add(107);
test1.add(103);
test1.add(103);
test1.add(106);
test1.add(105);
test1.add(101);
test1.add(101);
test1.add(101);
test1.add(104);
test1.add(103);
test1.add(102);
int lg = countPairs(test1);
System.out.println(lg);
@ -4600,8 +4622,9 @@ public class ChangShaSuanFaTest {
//测试吃:
List<Integer> allcard = new ArrayList<>();
allcard.add(208);
allcard.add(208);
allcard.add(108);
allcard.add(109);
allcard.add(107);
/*ITArray opcard = TArray.newInstance();
opcard.addInt(209);
opcard.addInt(208);*/
@ -4614,14 +4637,15 @@ public class ChangShaSuanFaTest {
List<Integer>changShachuguopai = new ArrayList<>();
//changShachuguopai.add(101);
// changShachuguopai.add(207);
changShachuguopai.addAll(allcard);
List<Integer> gangguopai = new ArrayList<>();
//gangguopai.add(206);
// gangguopai.add(206);
//gangguopai.add(206);
//gangguopai.add(206);
int card = 202;
int card = 101;
List<Integer>pengCard = new ArrayList<>();
// pengCard.add(102);
//出牌求优

View File

@ -747,6 +747,8 @@ public class ChangshaWinSplitCard {
System.out.println("258将牌: " + is258Cards);
System.out.println("非258牌: " + non258Cards);
//判断是否手牌有其他对将
// 优先从非258牌中选
if (!non258Cards.isEmpty()) {
@ -754,6 +756,7 @@ public class ChangshaWinSplitCard {
}
// 如果没有非258牌从258牌中选
if (!is258Cards.isEmpty()) {
return selectBestSingleCard(is258Cards);
}

View File

@ -20,9 +20,9 @@ public class RoomCard {
public void init() {
this.cardList.clear();
this.subCardList.clear();
//this.initCard();
//this.shuffle();
this.initCard2();
this.initCard();
this.shuffle();
// this.initCard2();
}
private void initCard2() {
@ -150,7 +150,7 @@ public class RoomCard {
// 发牌
public List<Integer> deal(EXPlayer owner, int num) {
List<Integer> dealCards = new ArrayList<>();
// shuffle();
shuffle();
for (int index = 0; index < num ; index++) {
double rand = Math.random() % 100 * 100;