-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewmain - Interface.cpp
720 lines (651 loc) · 24.4 KB
/
newmain - Interface.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
#include <iostream>
#include <cmath>
#include "Deck2.h"
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
char player_action ,player_action0,pa_tmp;
bool check(vector<int>);
vector<int> ChooseCard(Player,bool);
int moreCard(vector<int> ,int);
int main(){
mainmenu :
srand(unsigned(time(NULL)));
int num;
int maxCard;
int maxTable;
vector<int> hand;
start :
cout << "********************************************************************************************************\n";
cout << "********************************************************************************************************\n";
cout << "****** ******\n";
cout << "****** SSSS L A V V EEEEE M M A SSSS TTTTT EEEEE RRRR ******\n";
cout << "****** S L A V V E M M M M A S T E R R ******\n";
cout << "****** SSSS L A A V V EEEEE M M M A A SSSS T EEEEE RRRR ******\n";
cout << "****** S L AAAAA V E M M AAAAA S T E R R ******\n";
cout << "****** SSSS LLLLL A A V EEEEE M M A A SSSS T EEEEE R R ******\n";
cout << "****** ******\n";
cout << "********************************************************************************************************\n";
cout << "********************************************************************************************************\n\n";
cout << " ---------------------------------------------------------------------------------------------------\n";
cout << "| PPPP L EEEEE A SSSS EEEEE PPPP L A Y Y OOOOO N N |\n";
cout << "| P P L E A S E P P L A Y Y O O NN N |\n";
cout << "| PPPP L EEEEE A A SSSS EEEEE PPPP L A A Y O O N N N |\n";
cout << "| P L E AAAAA S E P L AAAAA Y O O N N N |\n";
cout << "| P LLLLL EEEEE A A SSSS EEEEE P LLLLL A A Y OOOOO N NN |\n" << "\n\n";
cout << "| FFFFF U U L L SSSS CCCC RRRR EEEEE EEEEE N N |\n";
cout << "| F U U L L S C R R E E NN N |\n";
cout << "| FFFFF U U L L --- SSSS C RRRR EEEEE EEEEE N N N |\n";
cout << "| F U U L L S C R R E E N N N |\n";
cout << "| F UUU LLLLL LLLLL SSSS CCCC R R EEEEE EEEEE N NN |\n" << "\n";
cout << " ---------------------------------------------------------------------------------------------------\n\n";
cout << "[1] Play with BOT(NOT AVALIABLE!!), [2] 2 Players, [3] 3 Players, [4] 4 Players\n"; //Add
cout << "PLAY SELECT : "; //Add
cin >> num;
if(num>4 || num<1) {
cout << "Please select again\n";
goto start;
}
string name[num];
cin.ignore();
for(int i=0;i<num;i++){
cout << "Please input Player "<< i+1 << " name: ";
getline(cin,name[i]);
}
playagain :
Deck c1;
c1.ShuffleCard();
c1.ShuffleFace();
if(num==2){
char paga='\0';
vector<string> tmpface=c1.cardFace;
vector<string> Table;
int state=0;
int turnc=1;
bool T_empty=true;
vector<int> gettmp;
Player p1(name[0],c1.cardFace,c1.cards,c1.faceShuff,0,26); // get cards from deck
Player p2(name[1],c1.cardFace,c1.cards,c1.faceShuff,26,52);
p1.sortcard(); p1.sortface(); p2.sortcard(); p2.sortface(); // sorting card that get from deck
gettmp=p1.GetCard();
while(true){
if(turnc==1){
if(find(gettmp.begin(),gettmp.end(),0) != gettmp.end()){ // Check if who play first
state=1;
cout << "\n----------------Player[1] Play FIRST----------------\n";
}else{
state=2;
cout << "\n----------------Player[2] Play FIRST----------------\n";
}
if(state==1){//Player 1 first play
while(true){
hand.clear();
hand=ChooseCard(p1,T_empty);
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(find(hand.begin(),hand.end(),0) != hand.end()){
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p1.eraseCard(hand[i]); // Erase cards that already used
p1.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}else cout << "\n--------There is no 3\5 in your selected card, choose your card again--------\n";
}
state=2;
}else if(state==2){
while(true){
hand.clear();
hand=ChooseCard(p2,T_empty); // function choose card
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(find(hand.begin(),hand.end(),0) != hand.end()){
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p2.eraseCard(hand[i]); // Erase cards that already used
p2.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}else cout << "\n--------There is no 3\5 in your selected card, choose your card again--------\n";
}
state=1;
}
turnc++;
}else{
if(Table.size()>0) T_empty=false;
else T_empty=true;
if(state==1){
while(true){
cout << "\n\n------------------------------- Card Table -------------------------------\n\n\n\n\n\n\n\n\n\n\n";
for(int i=0;i<Table.size();i++){
cout << " |" << Table[i] << "| ";
}
cout << "\n\n\n\n\n\n\n\n\n\n\n--------------------------------------------------------------------------\n";
cout << "\n\n---------------------------- Player[1] turn ----------------------------\n\n";
hand.clear();
hand=ChooseCard(p1,T_empty); // function choose card
if(hand.size()>0){
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(maxCard<maxTable){ // if cards on hand are less value than cards on the table -> choose cards again!
cout << "\n--------Choose your card again--------\n";
}else{
Table.clear();
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p1.eraseCard(hand[i]); // Erase cards that already used
p1.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}
}else {
Table.clear();
maxTable=0;
p1.newturn();
p2.newturn();
break;
}
}
if(p1.isWin()){
system("cls");
cout << "Player 1 is the Winner!! and now \"KING\" \n";
cout << "Play again ?\n";
cout << "[Y] play again [N] Exit to main menu [E] Exit :";
cin >> paga;
if(paga=='Y'||paga=='y') goto playagain;
else if(paga=='N'||paga=='n') goto mainmenu;
else if(paga=='E'||paga=='e') break;
}
state=2;
}else if(state==2){
while(true){
cout << "\n\n------------------------------- Card Table -------------------------------\n\n\n\n\n\n\n\n\n\n\n";
for(int i=0;i<Table.size();i++){
cout << " |" << Table[i] << "| ";
}
cout <<"\n\n\n\n\n\n\n\n\n\n\n--------------------------------------------------------------------------\n";
cout << "\n\n---------------------------- Player[2] turn ----------------------------\n\n";
hand.clear();
hand=ChooseCard(p2,T_empty); // function choose card
if(hand.size()>0){
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(maxCard<maxTable){ // if cards on hand are less value than cards on the table -> choose cards again!
cout << "\n--------Choose your card again--------\n";
}else{
Table.clear();
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p2.eraseCard(hand[i]); // Erase cards that already used
p2.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}
}else {
Table.clear();
maxTable=0;
p1.newturn();
p2.newturn();
break;
}
}
if(p2.isWin()){
system("cls");
cout << "Player 2 is the Winner!! and now \"KING\" \n";
cout << "Play again ?\n";
cout << "[Y] play again [N] Exit to main menu [E] Exit :";
cin >> paga;
if(paga=='Y'||paga=='y') goto playagain;
else if(paga=='N'||paga=='n') goto mainmenu;
else if(paga=='E'||paga=='e') break;
}
state=1;
}
}
}
}else if(num==3){
Player p1(name[0],c1.cardFace,c1.cards,c1.faceShuff,0,17);
Player p2(name[1],c1.cardFace,c1.cards,c1.faceShuff,17,34);
Player p3(name[2],c1.cardFace,c1.cards,c1.faceShuff,34,52); // 1 more card than other
p1.sortcard();p1.sortface();p2.sortcard();p2.sortface();p3.sortcard();p3.sortface();
char paga='\0';
vector<string> tmpface=c1.cardFace;
vector<string> Table;
int state=0;
int kingchk=0;
int endchk=0;
int turnc=1;
bool T_empty=true;
vector<int> gettmp;
vector<int> gettmp2;
gettmp=p1.GetCard();
gettmp2=p2.GetCard();
int pass=0;
while(true){
if(turnc==1){
if(find(gettmp.begin(),gettmp.end(),0) != gettmp.end()){ // Check if who play first
state=1;
cout << "\n--------Player1 play first--------\n";
}else if(find(gettmp2.begin(),gettmp2.end(),0) != gettmp2.end()){
state=2;
cout << "\n--------Player2 play first--------\n";
}else{
state=3;
cout << "\n--------Player3 play first--------\n";
}
if(state==1){//Player 1 first play
while(true){
hand.clear();
hand=ChooseCard(p1,T_empty);
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(find(hand.begin(),hand.end(),0) != hand.end()){
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p1.eraseCard(hand[i]); // Erase cards that already used
p1.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}else cout << "\n--------There is no 3\5 in your selected card, choose your card again--------\n\n";
}
state=2;
}else if(state==2){
while(true){
hand.clear();
hand=ChooseCard(p2,T_empty); // function choose card
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(find(hand.begin(),hand.end(),0) != hand.end()){
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p2.eraseCard(hand[i]); // Erase cards that already used
p2.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}else cout << "\n--------There is no 3\5 in your selected card, choose your card again--------\n\n";
}
state=3;
}else if(state==3){
while(true){
hand.clear();
hand=ChooseCard(p3,T_empty); // function choose card
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(find(hand.begin(),hand.end(),0) != hand.end()){
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p3.eraseCard(hand[i]); // Erase cards that already used
p3.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}else cout << "\n--------There is no 3\5 in your selected card, choose your card again--------\n\n";
}
state=1;
}
turnc++;
}else{
if(Table.size()>0) T_empty=false;
else T_empty=true;
if(state==1){
if(p2.plpass&&pass==2){
p1.newturn();
p2.newturn();
p3.newturn();
}
if(pass==2)pass=0;
while(true){
if(kingchk==1)break;
cout << "\n\n------------------------------- Card Table -------------------------------\n\n\n\n\n\n\n\n\n\n\n";
for(int i=0;i<Table.size();i++){
cout << " |" << Table[i] << "| ";
}
cout <<"\n\n\n\n\n\n\n\n\n\n\n--------------------------------------------------------------------------\n";
cout << "\n\n---------------------------- Player[1] turn ----------------------------\n\n";
hand.clear();
hand=ChooseCard(p1,T_empty); // function choose card
if(hand.size()>0){
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(maxCard<maxTable){ // if cards on hand are less value than cards on the table -> choose cards again!
cout << "\n--------Choose your card again--------\n";
}else{
Table.clear();
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p1.eraseCard(hand[i]); // Erase cards that already used
p1.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}
}else{ // if player pass code goes here
pass++;
if(pass==1){ //first pass
p1.pass();
break;
}else if(pass==2){
Table.clear();
maxTable=0;
if(p2.plpass)state=3;
else state=2;
p1.newturn();
p2.newturn();
p3.newturn();
break;
}
}
}
if(kingchk==0){
if(p1.isWin()){
system("cls");
cout << "Player 1 is the Winner!! and now \"KING\" \n";
kingchk=1;
endchk+=1;
}
}else {
if(p1.isEmptyHand()&&kingchk!=1){
system("cls");
endchk+=1;
if(endchk==2) cout << "You are now People\n";
else cout << "You are now Slave";
if(endchk==3){
cout << "Play again ?\n";
cout << "[Y] Play again [N] Exit to main menu [E] Exit :";
cin >> paga;
if(paga=='Y'||paga=='y') goto playagain;
else if(paga=='N'||paga=='n') goto mainmenu;
else if(paga=='E'||paga=='e') break;
}
}
}
if(pass!=2){
if(p2.plpass)state=3;
else state=2;
}
}else if(state==2){
if(pass==2)pass=0;
while(true){
cout << "\n\n------------------------------- Card Table -------------------------------\n\n\n\n\n\n\n\n\n\n\n";
for(int i=0;i<Table.size();i++){
cout << " |" << Table[i] << "| ";
}
cout <<"\n\n\n\n\n\n\n\n\n\n\n--------------------------------------------------------------------------\n";
cout << "\n\n---------------------------- Player[2] turn ----------------------------\n\n";
hand.clear();
hand=ChooseCard(p2,T_empty); // function choose card
if(hand.size()>0){
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(maxCard<maxTable){ // if cards on hand are less value than cards on the table -> choose cards again!
cout << "\n--------Choose your card again--------\n";
}else{
Table.clear();
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p2.eraseCard(hand[i]); // Erase cards that already used
p2.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}
}else {
pass++;
if(pass==1){ //first pass
p2.pass();
break;
}else if(pass==2){
Table.clear();
maxTable=0;
if(p3.plpass)state=1;
else state=3;
p1.newturn();
p2.newturn();
p3.newturn();
break;
}
}
}
if(kingchk==0){
if(p2.isWin()){
system("cls");
cout << "Player 2 is the Winner!! and now \"KING\" \n";
kingchk=2;
endchk+=1;
}
}else {
if(p2.isEmptyHand()&&kingchk!=2){
system("cls");
endchk+=1;
if(endchk==2) cout << "You are now People\n";
else cout << "You are now Slave";
if(endchk==3){
cout << "Play again ?\n";
cout << "[Y] Play again [N] Exit to main menu [E] Exit :";
cin >> paga;
if(paga=='Y'||paga=='y') goto playagain;
else if(paga=='N'||paga=='n') goto mainmenu;
else if(paga=='E'||paga=='e') break;
}
}
}
if(pass!=2){
if(p3.plpass)state=1;
else state=3;
}
}else if(state==3){
if(pass==2)pass=0;
while(true){
cout << "\n\n------------------------------- Card Table -------------------------------\n\n\n\n\n\n\n\n\n\n\n";
for(int i=0;i<Table.size();i++){
cout << " |" << Table[i] << "| ";
}
cout <<"\n\n\n\n\n\n\n\n\n\n\n--------------------------------------------------------------------------\n";
cout << "\n\n---------------------------- Player[3] turn ----------------------------\n\n";
hand.clear();
hand=ChooseCard(p3,T_empty); // function choose card
if(hand.size()>0){
maxCard=*max_element(hand.begin(),hand.end()); // find maximun value of cards on hand to compare with value of cards on table
maxCard=moreCard(hand,maxCard);
if(maxCard<maxTable){ // if cards on hand are less value than cards on the table -> choose cards again!
cout << "\n--------Choose your card again--------\n";
}else{
Table.clear();
for(int i=0;i<hand.size();i++){
Table.push_back(tmpface[hand[i]]);
p3.eraseCard(hand[i]); // Erase cards that already used
p3.decCardCount();
}
maxTable=maxCard; // if value of cards on hand > value of cards on table you can use that cards -> put card on table
break;
}
}else {
pass++;
if(pass==1){ //first pass
p3.pass();
break;
}else if(pass==2){
Table.clear();
maxTable=0;
if(p1.plpass)state=2;
else state=1;
p1.newturn();
p2.newturn();
p3.newturn();
break;
}
}
}
if(kingchk==0){
if(p3.isWin()){
system("cls");
cout << "Player 3 is the Winner!! and now \"KING\" \n";
kingchk=2;
endchk+=1;
}
}else {
if(p3.isEmptyHand()&&kingchk!=1){
system("cls");
endchk+=1;
if(endchk==2) cout << "You are now People\n";
else cout << "You are now Slave";
if(endchk==3){
cout << "Play again ?\n";
cout << "[Y] Play again [N] Exit to main menu [E] Exit :";
cin >> paga;
if(paga=='Y'||paga=='y') goto playagain;
else if(paga=='N'||paga=='n') goto mainmenu;
else if(paga=='E'||paga=='e') break;
}
}
}
if(pass!=2){
if(p1.plpass)state=2;
else state=1;
}
}
turnc++;
}
}
}else if(num==4){
Player p1(name[0],c1.cardFace,c1.cards,c1.faceShuff,0,13);
Player p2(name[1],c1.cardFace,c1.cards,c1.faceShuff,13,26);
Player p3(name[2],c1.cardFace,c1.cards,c1.faceShuff,26,39);
Player p4(name[3],c1.cardFace,c1.cards,c1.faceShuff,39,52);
p1.sortcard();
p1.sortface();
p2.sortcard();
p2.sortface();
p3.sortcard();
p3.sortface();
p4.sortcard();
p4.sortface();
}
exit :
return 0;
}
int moreCard(vector<int> hand,int max){
if(hand.size()==2)max+=100;
else if(hand.size()==3)max+=200;
else if(hand.size()==4)max+=300;
return max;
}
bool check(vector<int> card){
int temp=card[0]/4;
for(int i=0;i<card.size();i++){
if(temp==card[i]/4);
else return true;
}
return false;
}
vector<int> ChooseCard(Player P,bool t_empty){
bool chk;
vector<int> getcard;
vector<int> order;
vector<int> cardChoose=P.GetCard();
vector<string> cFace=P.GetFace();
int choose1,choose2,choose3,choose4;
// system("cls");
for(int i=0;i<cardChoose.size();i++){
order.push_back(i);
}
for(int i=0;i<cFace.size();i++){
if(i<=9 && (cardChoose[i]>=28&&cardChoose[i]<=31)) cout << order[i] <<" ";
else if(i<=9) cout << order[i] <<" ";
else{
if(cardChoose[i]>=28&&cardChoose[i]<=31) cout << order[i] <<" ";
else cout << order[i] <<" ";
}
}
cout << "\n";
for(int i=0;i<cFace.size();i++){
cout << cFace[i]<< " ";
}
cout << "\n\n";
step1 :
// if (player_action0=='p'){do{
// cout<<"choose your action \n [1] 1 card [2] 2 card [3] 3 card [4] 4 card : ";
// cin>>player_action;
// }while(player_action!='1'and player_action!='2'and player_action!='3'and player_action!='4');
// goto step2;
// }
if(t_empty==true){
do{
cout << "[1] One card, [2] Pair, [3] Three of kind, [4] Four of kind \n\nChoose your action = ";
cin>>player_action;
}while(player_action!='1'and player_action!='2'and player_action!='3'and player_action!='4');
goto step2;
}
else if(player_action0=='1'){
do{
cout<<"[1] One card, [3] Three of kind, [p] Pass \n\nChoose your action = ";
cin>>player_action;
}while(player_action!='1'and player_action!='3'and player_action!='p');
goto step2;
}
else if(player_action0=='2'){
do{
cout<<"[2] One card, [4] TFour of kind, [p] Pass \n\nChoose your action = ";
cin>>player_action;
}while(player_action!='2'and player_action!='4'and player_action!='p');
goto step2;
}
else if(player_action0=='3'){
do{
cout<<"[3] Three of kind, [p] Pass \n\nChoose your action = ";
cin>>player_action;
}while(player_action!='3'and player_action!='p');
goto step2;
}
else if(player_action0=='4'){
do{
cout<<"[4] TFour of kind, [p] Pass \n\nChoose your action = ";
cin>>player_action;
}while(player_action!='4'and player_action!='p');
goto step2;
}
step2 :
switch(player_action){
case '1': cout << "Choose card from number up here:";
cin>>choose1;
getcard.push_back(cardChoose[choose1]);
break;
case '2': cout << "Choose card from number up here (use space):";
cin>>choose1>>choose2;
getcard.push_back(cardChoose[choose1]);
getcard.push_back(cardChoose[choose2]);
break;
case '3': cout << "Choose card from number up here (use space):";
cin>>choose1>>choose2>>choose3;
getcard.push_back(cardChoose[choose1]);
getcard.push_back(cardChoose[choose2]);
getcard.push_back(cardChoose[choose3]);
break;
case '4': cout << "Choose card from number up here (use space):";
cin>>choose1>>choose2>>choose3>>choose4;
getcard.push_back(cardChoose[choose1]);
getcard.push_back(cardChoose[choose2]);
getcard.push_back(cardChoose[choose3]);
getcard.push_back(cardChoose[choose4]);
break;
case 'p':
case 'P':{
player_action0=pa_tmp;
return getcard;
}
}
chk=check(getcard);
if(chk){
getcard.clear();
cout << "\n-------- Your cards are not match, Please choose again--------\n";
goto step1;
}else {
pa_tmp=player_action0=player_action;
return getcard;
}
}