修复【彩妆】ai算法上的一个逻辑错误
This commit is contained in:
parent
f3428a983e
commit
9dfd3648f4
|
@ -3833,27 +3833,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
cache={no:true};
|
cache={no:true};
|
||||||
_status.event.putTempCache('dccaizhuang','dsuits',cache);
|
_status.event.putTempCache('dccaizhuang','dsuits',cache);
|
||||||
let player=_status.event.player,suits={};
|
let player=_status.event.player,suits={};
|
||||||
|
lib.suit.forEach(i=>{
|
||||||
|
suits[i]=0;
|
||||||
|
});
|
||||||
player.getCards('h',i=>{
|
player.getCards('h',i=>{
|
||||||
let suit=get.suit(i);
|
let suit=get.suit(i);
|
||||||
if(suits[suit]) suits[suit]++;
|
if(lib.suit.includes(suit)) suits[suit]++;
|
||||||
else suits[suit]=1;
|
|
||||||
});
|
});
|
||||||
const sortedEntries=Object.entries(suits).sort((a,b)=>b[1]-a[1]);
|
let sortedSuits=Object.fromEntries(Object.entries(suits).sort((a,b)=>b[1]-a[1]));
|
||||||
let sortedSuits=Object.fromEntries(sortedEntries);
|
|
||||||
let dis=0,idx=0,dsuits=0,leave=0;
|
let dis=0,idx=0,dsuits=0,leave=0;
|
||||||
for(let i in sortedSuits){
|
for(let i in sortedSuits){
|
||||||
idx++;
|
idx++;
|
||||||
if(!sortedSuits[i]) continue;
|
if(!sortedSuits[i]) continue;
|
||||||
if(idx>2||sortedSuits[i]<3){
|
let num=1;
|
||||||
cache[i]=sortedSuits[i];
|
if(idx>2||sortedSuits[i]<3) num=sortedSuits[i];
|
||||||
dis+=sortedSuits[i];
|
cache[i]=num;
|
||||||
suits[i]=0;
|
dis+=num;
|
||||||
}
|
suits[i]-=num;
|
||||||
else{
|
|
||||||
cache[i]++;
|
|
||||||
dis++;
|
|
||||||
suits[i]--;
|
|
||||||
}
|
|
||||||
dsuits++;
|
dsuits++;
|
||||||
}
|
}
|
||||||
for(let i in suits){
|
for(let i in suits){
|
||||||
|
@ -3868,7 +3864,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let draw=0,e=[0,1,4/3,2,4];
|
let draw=0,e=[0,1,4/3,2,4];
|
||||||
dsuits=Math.min(4,dsuits);
|
|
||||||
if(dsuits<=leave) return false;
|
if(dsuits<=leave) return false;
|
||||||
do{
|
do{
|
||||||
draw+=e[dsuits--];
|
draw+=e[dsuits--];
|
||||||
|
|
Loading…
Reference in New Issue