提交 bfc11153 编写于 作者: C changjiuxiong

AI 组牌

上级 570e189e
...@@ -272,6 +272,16 @@ class AI{ ...@@ -272,6 +272,16 @@ class AI{
} }
} }
//combine oneList oneList together
oneList.sort(this.sortList);
for(let i12=1; i12<oneList.length; i12++){
if(oneList[i12][0][0].number===oneList[i12-1][oneList[i12-1].length-1][0].number+1){
oneList[i12-1] = oneList[i12-1].concat(oneList[i12]);
oneList.splice(i12,1);
i12--;
}
}
return { return {
four, four,
three, three,
...@@ -294,6 +304,10 @@ class AI{ ...@@ -294,6 +304,10 @@ class AI{
return a[0].number - b[0].number; return a[0].number - b[0].number;
} }
sortList(a, b){
return a[0][0].number - b[0][0].number;
}
} }
export default AI; export default AI;
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册