2021-10-27 15:40:44 +00:00
|
|
|
|
#include "vec.cpp"
|
|
|
|
|
#include "list.cpp"
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "score.h"
|
|
|
|
|
|
|
|
|
|
std::string PU[54] = {
|
|
|
|
|
"3D", "3C", "3B", "3A",
|
|
|
|
|
"4D", "4C", "4B", "4A",
|
|
|
|
|
"5D", "5C", "5B", "5A",
|
|
|
|
|
"6D", "6C", "6B", "6A",
|
|
|
|
|
"7D", "7C", "7B", "7A",
|
|
|
|
|
"8D", "8C", "8B", "8A",
|
|
|
|
|
"9D", "9C", "9B", "9A",
|
|
|
|
|
"XD", "XC", "XB", "XA",
|
|
|
|
|
"JD", "JC", "JB", "JA",
|
|
|
|
|
"QD", "QC", "QB", "QA",
|
|
|
|
|
"KD", "KC", "KB", "KA",
|
|
|
|
|
"1D", "1C", "1B", "1A",
|
|
|
|
|
"2D", "2C", "2B", "2A",
|
|
|
|
|
"BJ", "RJ"};
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
Score s(3);
|
|
|
|
|
int xipai_flag = 0;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
srand(time(NULL));
|
|
|
|
|
Vec v(54, 2);
|
|
|
|
|
// v.printall();
|
|
|
|
|
|
|
|
|
|
List l;
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <= 53; i++)
|
|
|
|
|
{
|
|
|
|
|
l.firstInsert(v.get(i));
|
|
|
|
|
std::cout << PU[l[0]] << " ";
|
|
|
|
|
if (i % 2 != 0)
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Begin:
|
|
|
|
|
printf("\n<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><EFBFBD>?(0/1)");
|
|
|
|
|
scanf("%d", &xipai_flag);
|
|
|
|
|
|
|
|
|
|
if (xipai_flag == 1)
|
|
|
|
|
{
|
|
|
|
|
v.reorder();
|
|
|
|
|
|
|
|
|
|
l.clear();
|
|
|
|
|
|
|
|
|
|
printf("===============<3D><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>===============\n");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <= 53; i++)
|
|
|
|
|
{
|
|
|
|
|
l.firstInsert(v.get(i));
|
|
|
|
|
std::cout << PU[l[0]] << " ";
|
|
|
|
|
if (i % 2 != 0)
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
xipai_flag == 0;
|
|
|
|
|
goto Begin;
|
|
|
|
|
}
|
|
|
|
|
printf("===============<3D><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>===============\n");
|
|
|
|
|
List p1, p2, p3;
|
|
|
|
|
for (int i = 0; i <= 53; i++)
|
|
|
|
|
{
|
|
|
|
|
switch (i % 3)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
p1.firstInsert(l[i]);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
p2.firstInsert(l[i]);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
p3.firstInsert(l[i]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
l.clear();
|
|
|
|
|
p1.sort();
|
|
|
|
|
p2.sort();
|
|
|
|
|
p3.sort();
|
|
|
|
|
l.firstInsert(-1);
|
|
|
|
|
int opt = 0;
|
|
|
|
|
int pass_num = 0;
|
|
|
|
|
int round = 1;
|
|
|
|
|
int finish_num = 0;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>:\n");
|
2021-10-27 16:20:29 +00:00
|
|
|
|
while (finish_num < 2&&round<54)
|
2021-10-27 15:40:44 +00:00
|
|
|
|
{
|
2021-10-27 16:20:29 +00:00
|
|
|
|
|
|
|
|
|
if (pass_num > 3 - finish_num)
|
|
|
|
|
pass_num = 3 - finish_num;
|
|
|
|
|
printf("+++++===========================+++++\n <20>ִ<EFBFBD>%d \n+++++===========================+++++\n", round);
|
|
|
|
|
|
2021-10-27 15:40:44 +00:00
|
|
|
|
if (p1.getSize())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
for (int i = 0; i < p1.getSize(); i++)
|
|
|
|
|
{
|
|
|
|
|
std::cout << i << ": " << PU[(p1)[i]] << "\n";
|
|
|
|
|
}
|
|
|
|
|
printf("ʣ<EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD>\n", p1.getSize());
|
|
|
|
|
|
|
|
|
|
if (l[0] > p1[p1.getSize() - 1])
|
|
|
|
|
{
|
|
|
|
|
if (pass_num == 2 - finish_num)
|
|
|
|
|
{
|
|
|
|
|
pass_num = 0;
|
|
|
|
|
goto A;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
pass_num++;
|
|
|
|
|
goto B;
|
|
|
|
|
}
|
2021-10-27 16:20:29 +00:00
|
|
|
|
A:
|
2021-10-27 15:40:44 +00:00
|
|
|
|
printf("1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD>鿴<EFBFBD>ƶ<EFBFBD>");
|
|
|
|
|
scanf("%d", &opt);
|
|
|
|
|
switch (opt)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
printf("ѡ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d", &opt);
|
|
|
|
|
if (opt >= p1.getSize())
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
goto A;
|
|
|
|
|
}
|
|
|
|
|
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << PU[l.firstInsert((p1).remove(opt))];
|
|
|
|
|
if (int size = p1.getSize() == 0)
|
|
|
|
|
{
|
|
|
|
|
s.finish(0);
|
|
|
|
|
printf(",<2C><><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
finish_num++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf(",ʣ<><CAA3>%d<><64><EFBFBD><EFBFBD>\n", p1.getSize());
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
for (int i = 0; i < l.getSize() - 1; i++)
|
|
|
|
|
{
|
|
|
|
|
std::cout << i << ": " << PU[l[i]];
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
goto A;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
goto A;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-27 16:20:29 +00:00
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>ֿ<EFBFBD>\n");
|
2021-10-27 15:40:44 +00:00
|
|
|
|
B:
|
|
|
|
|
if (p2.getSize())
|
|
|
|
|
{
|
|
|
|
|
printf("================================\n");
|
|
|
|
|
printf("B<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
|
|
|
|
|
if (pass_num == 2 - finish_num)
|
|
|
|
|
{
|
|
|
|
|
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << PU[l.firstInsert((p2).remove(0))];
|
|
|
|
|
printf(",ʣ<><CAA3>%d<><64><EFBFBD><EFBFBD>\n", p2.getSize());
|
|
|
|
|
pass_num = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (l[0] > p2[p2.getSize() - 1])
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ƿɳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
pass_num++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
for (int i = 0; i < p2.getSize(); i++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (l[0] < p2[i])
|
|
|
|
|
{
|
|
|
|
|
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << PU[l.firstInsert((p2).remove(i))];
|
|
|
|
|
if (int size = p2.getSize() == 0)
|
|
|
|
|
{
|
|
|
|
|
s.finish(1);
|
|
|
|
|
printf(",<2C><><EFBFBD><EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
finish_num++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf(",ʣ<><CAA3>%d<><64><EFBFBD><EFBFBD>\n", p2.getSize());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-27 16:20:29 +00:00
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>ֿ<EFBFBD>\n");
|
2021-10-27 15:40:44 +00:00
|
|
|
|
C:
|
|
|
|
|
if (p3.getSize())
|
|
|
|
|
{
|
|
|
|
|
printf("================================\n");
|
|
|
|
|
printf("C<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
|
|
|
|
|
if (pass_num == 2 - finish_num)
|
|
|
|
|
{
|
|
|
|
|
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << PU[l.firstInsert((p3).remove(0))];
|
|
|
|
|
printf(",ʣ<><CAA3>%d<><64><EFBFBD><EFBFBD>\n", p3.getSize());
|
|
|
|
|
pass_num = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (l[0] > p3[p3.getSize() - 1])
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ƿɳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
pass_num++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
for (int i = 0; i < p3.getSize(); i++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (l[0] < p3[i])
|
|
|
|
|
{
|
|
|
|
|
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << PU[l.firstInsert((p3).remove(i))];
|
|
|
|
|
if (int size = p3.getSize() == 0)
|
|
|
|
|
{
|
|
|
|
|
s.finish(2);
|
|
|
|
|
printf(",<2C><><EFBFBD><EFBFBD>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
finish_num++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf(",ʣ<><CAA3>%d<><64><EFBFBD><EFBFBD>\n", p3.getSize());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-27 16:20:29 +00:00
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD>ֿ<EFBFBD>\n");
|
2021-10-27 15:40:44 +00:00
|
|
|
|
round++;
|
|
|
|
|
}
|
|
|
|
|
printf("=====================================\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>A:%d<><64>\n", s.score(0));
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>B:%d<><64>\n", s.score(1));
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>C:%d<><64>\n", s.score(2));
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|