6似乎是没bug了

This commit is contained in:
iridiumR 2021-10-28 19:30:56 +08:00
parent 000670f603
commit 442a76e226
2 changed files with 34 additions and 25 deletions

View file

@ -63,7 +63,7 @@ Begin:
xipai_flag == 0; xipai_flag == 0;
goto Begin; goto Begin;
} }
printf("===============开始发牌===============\n"); printf("================开始发牌================\n");
List p1, p2, p3; List p1, p2, p3;
for (int i = 0; i <= 53; i++) for (int i = 0; i <= 53; i++)
{ {
@ -80,6 +80,11 @@ Begin:
break; break;
} }
} }
printf("你手中的牌:\n");
for (int i = 0; i < p1.getSize(); i++)
{
std::cout << i << ": " << PU[(p1)[i]] << "\n";
}
l.clear(); l.clear();
p1.sort(); p1.sort();
p2.sort(); p2.sort();
@ -89,8 +94,8 @@ Begin:
int pass_num = 0; int pass_num = 0;
int round = 1; int round = 1;
int finish_num = 0; int finish_num = 0;
printf("发牌完成,选择你的操作:\n"); printf("发牌完成,选择你的操作:\n");
while (finish_num < 2&&round<54) while (finish_num < 2 && round < 54)
{ {
if (pass_num > 3 - finish_num) if (pass_num > 3 - finish_num)
@ -131,12 +136,14 @@ Begin:
printf("댄轎渴흙\n"); printf("댄轎渴흙\n");
goto A; goto A;
} }
std::cout << "打出" << PU[l.firstInsert((p1).remove(opt))]; if (p1[1])
std::cout << "打出" << PU[l.firstInsert((p1).remove(opt))];
if (int size = p1.getSize() == 0) if (int size = p1.getSize() == 0)
{ {
s.finish(0); s.finish(0);
printf(",鯤소A놔供杰唐탬\n"); printf(",鯤소A놔供杰唐탬\n");
finish_num++; finish_num++;
pass_num = 0;
} }
else else
printf(",假岱%d蠟탬\n", p1.getSize()); printf(",假岱%d蠟탬\n", p1.getSize());
@ -160,7 +167,7 @@ Begin:
B: B:
if (p2.getSize()) if (p2.getSize())
{ {
printf("================================\n"); printf("--------------------\n");
printf("B鯤소"); printf("B鯤소");
if (pass_num == 2 - finish_num) if (pass_num == 2 - finish_num)
@ -181,24 +188,25 @@ Begin:
if (l[0] < p2[i]) if (l[0] < p2[i])
{ {
std::cout << "댔놔" << PU[l.firstInsert((p2).remove(i))]; std::cout << "댔놔" << PU[l.firstInsert((p2).remove(i))];
if (int size = p2.getSize() == 0)
{ printf(",剩余%d张牌\n", p2.getSize());
s.finish(1);
printf(",玩家B出完所有牌\n");
finish_num++;
}
else
printf(",剩余%d张牌\n", p2.getSize());
break; break;
} }
} }
if (p2.getSize() == 0)
{
s.finish(1);
printf("玩家B出完所有牌\n");
finish_num++;
pass_num = 0;
}
} }
else else
printf("鯤소B쫴왕\n"); printf("鯤소B쫴왕\n");
C: C:
if (p3.getSize()) if (p3.getSize())
{ {
printf("================================\n"); printf("--------------------\n");
printf("C鯤소"); printf("C鯤소");
if (pass_num == 2 - finish_num) if (pass_num == 2 - finish_num)
@ -219,17 +227,18 @@ Begin:
if (l[0] < p3[i]) if (l[0] < p3[i])
{ {
std::cout << "댔놔" << PU[l.firstInsert((p3).remove(i))]; std::cout << "댔놔" << PU[l.firstInsert((p3).remove(i))];
if (int size = p3.getSize() == 0)
{ printf(",剩余%d张牌\n", p3.getSize());
s.finish(2);
printf(",玩家C出完所有牌\n");
finish_num++;
}
else
printf(",剩余%d张牌\n", p3.getSize());
break; break;
} }
} }
if (p3.getSize() == 0)
{
s.finish(2);
printf("玩家C出完所有牌\n");
finish_num++;
pass_num = 0;
}
} }
else else
printf("鯤소C쫴왕\n"); printf("鯤소C쫴왕\n");

View file

@ -10,14 +10,14 @@ public:
{ {
_size = i; _size = i;
_s = new int[_size - 1]; _s = new int[_size - 1];
for(int i=0;i<_size;i++) for (int i = 0; i < _size; i++)
{ {
_s[i]=0; _s[i] = 0;
} }
} }
void finish(int t) void finish(int t)
{ {
_s[t] = 3 - (time++); _s[t] = 3 - 1 - (time++);
} }
bool isFinish(int i) bool isFinish(int i)
{ {