提交 404680cf 编写于 作者: 微笑面对bug's avatar 微笑面对bug

完善规则

上级 a2598830
.poker[data-v-b556cf7e]{height:100%;width:100px;border:1px solid;border-radius:8px;float:left;margin-left:-50px;background-color:azure}.poker[data-v-b556cf7e]:hover{background-color:#faebd7}.selected[data-v-b556cf7e]{margin-top:-20px}
\ No newline at end of file
.poker[data-v-3cd822ae],.pokerDesk[data-v-3cd822ae]{height:100%;width:100px;border:1px solid;border-radius:16px;float:left;margin-left:-50px;background-color:azure;font-size:30px}.poker[data-v-3cd822ae]:hover{background-color:#faebd7}.selected[data-v-3cd822ae]{margin-top:-20px}
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><title>Vue App</title><link href=css/app.1475b526.css rel=preload as=style><link href=js/app.2113c29b.js rel=preload as=script><link href=js/chunk-vendors.caf18475.js rel=preload as=script><link href=css/app.1475b526.css rel=stylesheet></head><body><div id=app></div><script src=js/chunk-vendors.caf18475.js></script><script src=js/app.2113c29b.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><title>Vue App</title><link href=css/app.dcc00d5a.css rel=preload as=style><link href=js/app.4f03e253.js rel=preload as=script><link href=js/chunk-vendors.caf18475.js rel=preload as=script><link href=css/app.dcc00d5a.css rel=stylesheet></head><body><div id=app></div><script src=js/chunk-vendors.caf18475.js></script><script src=js/app.4f03e253.js></script></body></html>
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -9,7 +9,9 @@ class Game{
this.oldPokerList = [];
this.currentPlayer = [];
this.dizhu = null;
this.second = 20;
this.MaxSecond = 999999;
this.second = this.MaxSecond;
this.isOver = true;
this.init();
}
......@@ -23,10 +25,13 @@ class Game{
}
resetTime(){
this.second = 20;
this.second = this.MaxSecond;
}
timeLoop(){
if(this.isOver){
return;
}
this.second--;
if(this.second === 0){
......@@ -44,6 +49,7 @@ class Game{
}
start(){
this.isOver = false;
this.timeLoop();
this.currentPlayer = this.dizhu;
if(this.currentPlayer.isRobot){
......@@ -66,6 +72,7 @@ class Game{
gameOver(){
alert('gameOver! '+this.currentPlayer.name+' ['+this.currentPlayer.type+'] win!');
this.isOver = true;
}
checkGameOver(){
......
此差异已折叠。
......@@ -131,6 +131,16 @@ class Poker{
};
}
}else if(pokerList.length === 3){
if(Count3List.length === 1){
return {
type:'three',
poker: pokerList,
three: pokerList,
};
}
}else if(pokerList.length === 4){
if(Count3List.length === 1){
......@@ -157,54 +167,58 @@ class Poker{
three: Count3List[0],
two: Count2List[0],
};
}else if(Count4List.length === 1 && Count1List.length === 1){
return {
type:'fourWithOne',
poker: pokerList,
four: Count4List[0],
one: Count1List[0],
};
}
}else if(pokerList.length === 8){
}else if(pokerList.length === 6){
if(Count3List.length === 2 && Count3List[0][0].number+1===Count3List[1][0].number){
if(Count2List.length === 1){
Count1List.push(Count2List[0].splice(0,1));
Count1List.push(Count2List[0].splice(0,1));
}
if(Count4List.length === 1 && Count2List.length === 1){
return {
type:'threeWithOneList',
type:'fourWithTwo',
poker: pokerList,
list: [
{
three: Count3List[0],
one: Count1List[0],
},
{
three: Count3List[1],
one: Count1List[1],
}
],
four: Count4List[0],
two: Count2List[0],
};
}
}else if(pokerList.length === 10){
}
if(Count3List.length === 2 && Count3List[0][0].number+1===Count3List[1][0].number && Count2List.length === 2){
if(Count3List.length>=2 && Count3List[Count3List.length-1][0].number<=14 && Count3List[0][0].number+Count3List.length-1===Count3List[Count3List.length-1][0].number){
//threeWithOneList
if(pokerList.length-3*Count3List.length===Count3List.length){
return {
type:'threeWithTwoList',
type:'threeWithOneList',
poker: pokerList,
list: [
{
three: Count3List[0],
two: Count2List[0],
},
{
three: Count3List[1],
two: Count2List[1],
}
],
list: Count3List.map(function (item) {
return {
three: item,
};
}),
};
}else{
//threeWithTwoList
if(Count2List.length===Count3List.length){
return {
type:'threeWithTwoList',
poker: pokerList,
list: Count3List.map(function (item) {
return {
three: item,
};
}),
};
}
}
}
//判断oneList
if(pokerList.length >= 5 && Count1List.length === pokerList.length && pokerList[0].number+pokerList.length-1===pokerList[pokerList.length-1].number){
if(pokerList.length >= 5 && pokerList[pokerList.length-1].number<=14 && Count1List.length === pokerList.length && pokerList[0].number+pokerList.length-1===pokerList[pokerList.length-1].number){
return {
type:'oneList',
poker: pokerList,
......@@ -217,7 +231,7 @@ class Poker{
}
//判断twoList
if(pokerList.length >= 6 && pokerList.length%2 === 0 && Count2List.length === pokerList.length/2 && pokerList[0].number+pokerList.length/2-1===pokerList[pokerList.length-1].number){
if(pokerList.length >= 6 && pokerList[pokerList.length-1].number<=14 && pokerList.length%2 === 0 && Count2List.length === pokerList.length/2 && pokerList[0].number+pokerList.length/2-1===pokerList[pokerList.length-1].number){
return {
type:'twoList',
poker: pokerList,
......@@ -229,6 +243,19 @@ class Poker{
}
}
//判断threeList
if(pokerList.length >= 6 && pokerList[pokerList.length-1].number<=14 && pokerList.length%3 === 0 && Count3List.length === pokerList.length/3 && pokerList[0].number+pokerList.length/3-1===pokerList[pokerList.length-1].number){
return {
type:'threeList',
poker: pokerList,
list: Count3List.map(function (item) {
return {
three: item,
}
}),
}
}
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册