6似乎没有bug的版本

This commit is contained in:
iridiumR 2021-10-28 23:02:22 +08:00
parent 80e2d66f51
commit ba3d6259d1

View file

@ -94,7 +94,7 @@ 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)
{ {
@ -112,33 +112,30 @@ Begin:
} }
printf("剩余%d张牌\n", p1.getSize()); printf("剩余%d张牌\n", p1.getSize());
if (l[0] > p1[p1.getSize() - 1]) // if (l[0] > p1[p1.getSize() - 1])
{ // {
if (pass_num == 2 - finish_num) // if (pass_num == 2 - finish_num)
{ // {
pass_num = 0; // pass_num = 0;
goto A; // goto A;
} // }
printf("无法出牌,已自动跳过\n"); // printf("无法出牌,已自动跳过\n");
pass_num++; // }
goto B;
}
A: A:
printf("1出牌2查看牌堆"); printf("0出牌1查看牌堆2跳过");
scanf("%d", &opt); scanf("%d", &opt);
switch (opt) switch (opt)
{ {
case 1: case 0:
printf("选择:"); printf("选择:");
scanf("%d", &opt); scanf("%d", &opt);
if (opt >= p1.getSize()) if (opt >= p1.getSize() || (p1[opt] < l[0]&&pass_num!=2))
{ {
printf("错误输入\n"); printf("错误输入\n");
goto A; goto A;
} }
if (p1[1]) std::cout << "打出" << PU[l.firstInsert((p1).remove(opt))];
std::cout << "打出" << PU[l.firstInsert((p1).remove(opt))]; if (p1.getSize() == 0)
if (int size = p1.getSize() == 0)
{ {
s.finish(0); s.finish(0);
printf(",玩家A出完所有牌\n"); printf(",玩家A出完所有牌\n");
@ -147,9 +144,10 @@ Begin:
} }
else else
printf(",剩余%d张牌\n", p1.getSize()); printf(",剩余%d张牌\n", p1.getSize());
pass_num=0;
break; break;
case 2: case 1:
for (int i = 0; i < l.getSize() - 1; i++) for (int i = 0; i < l.getSize() - 1; i++)
{ {
std::cout << i << ": " << PU[l[i]]; std::cout << i << ": " << PU[l[i]];
@ -157,6 +155,10 @@ Begin:
} }
goto A; goto A;
case 2:
pass_num++;
goto B;
default: default:
printf("错误输入\n"); printf("错误输入\n");
goto A; goto A;
@ -190,6 +192,7 @@ Begin:
std::cout << "打出" << PU[l.firstInsert((p2).remove(i))]; std::cout << "打出" << PU[l.firstInsert((p2).remove(i))];
printf(",剩余%d张牌\n", p2.getSize()); printf(",剩余%d张牌\n", p2.getSize());
pass_num = 0;
break; break;
} }
} }
@ -229,6 +232,7 @@ Begin:
std::cout << "打出" << PU[l.firstInsert((p3).remove(i))]; std::cout << "打出" << PU[l.firstInsert((p3).remove(i))];
printf(",剩余%d张牌\n", p3.getSize()); printf(",剩余%d张牌\n", p3.getSize());
pass_num = 0;
break; break;
} }
} }
@ -250,5 +254,7 @@ Begin:
printf("玩家B:%d分\n", s.score(1)); printf("玩家B:%d分\n", s.score(1));
printf("玩家C:%d分\n", s.score(2)); printf("玩家C:%d分\n", s.score(2));
system("pause");
return 0; return 0;
} }