提交 ff798c3f 编写于 作者: C changjiuxiong

AI 组牌

上级 86131a99
...@@ -76,7 +76,6 @@ class AI{ ...@@ -76,7 +76,6 @@ class AI{
let Count3List = obj[3]; let Count3List = obj[3];
let Count4List = obj[4]; let Count4List = obj[4];
let sx = [];
let four = Count4List; let four = Count4List;
let three = []; let three = [];
let threeList = []; let threeList = [];
...@@ -84,11 +83,6 @@ class AI{ ...@@ -84,11 +83,6 @@ class AI{
let twoList = []; let twoList = [];
let one = []; let one = [];
let oneList = []; let oneList = [];
if(Count1List.length>1){
if(Count1List[Count1List.length-2][0].number===16){
sx = Count1List.slice(Count1List.length-2, Count1List.length);
}
}
if(Count3List.length>0){ if(Count3List.length>0){
let curList = [Count3List[0]]; let curList = [Count3List[0]];
...@@ -173,10 +167,11 @@ class AI{ ...@@ -173,10 +167,11 @@ class AI{
let ones = []; let ones = [];
let twos = []; let twos = [];
if(one.length===0){ if(one.length===0 || oneIndex>one.length-1){
break; break;
} }
if(two.length===0){
if(two.length===0 || twoIndex>two.length-1){
startN = one[oneIndex][0].number; startN = one[oneIndex][0].number;
ones.push(one[oneIndex]); ones.push(one[oneIndex]);
oneIndex++; oneIndex++;
...@@ -231,12 +226,12 @@ class AI{ ...@@ -231,12 +226,12 @@ class AI{
//delete from two //delete from two
for(let j1=0; j1<two.length; j1++){ for(let j1=0; j1<two.length; j1++){
if(two[j1]===pokers){ if(two[j1]===pokers){
one.splice(j1,1); two.splice(j1,1);
break; break;
} }
} }
let poker = pokers.splice(0); let poker = pokers.splice(0,1);
cmbList.push(poker); cmbList.push(poker);
one.push(pokers); one.push(pokers);
...@@ -261,7 +256,6 @@ class AI{ ...@@ -261,7 +256,6 @@ class AI{
} }
return { return {
sx,
four, four,
three, three,
threeList, threeList,
......
...@@ -19,6 +19,7 @@ class Player{ ...@@ -19,6 +19,7 @@ class Player{
getClassifyObj(){ getClassifyObj(){
this.classifyObj = this.ai.getClassifyObj(this.pokerList); this.classifyObj = this.ai.getClassifyObj(this.pokerList);
console.log(this.pokerListToString());
console.log(this.classifyObj); console.log(this.classifyObj);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册