bool PokerTest::fourOfKindTest() { bool status = true; std::cout << "four of kind test" << std::endl; Hand hand1(Card(Rank::TEN, Suit::CLUB), Card(Rank::TEN, Suit::DIAMOND), Card(Rank::TEN, Suit::HEART), Card(Rank::TEN, Suit::SPADE), Card(Rank::QUEEN, Suit::DIAMOND)); Hand hand2(Card(Rank::SIX, Suit::DIAMOND), Card(Rank::SIX, Suit::HEART), Card(Rank::SIX, Suit::SPADE), Card(Rank::SIX, Suit::CLUB), Card(Rank::SEVEN, Suit::SPADE)); PokerGame game1(hand1, hand2); std::cout << game1; if (game1.hasWinner()) { if (game1.getWinner() != hand1) { std::cerr << "incorrect hand won" << std::endl; status = false; } } else { std::cerr << "hand failed to determine winner" << std::endl; status = false; } Hand hand3(Card(Rank::TEN, Suit::CLUB), Card(Rank::TEN, Suit::DIAMOND), Card(Rank::TEN, Suit::HEART), Card(Rank::TEN, Suit::SPADE), Card(Rank::FIVE, Suit::CLUB)); Hand hand4(Card(Rank::TEN, Suit::CLUB), Card(Rank::TEN, Suit::DIAMOND), Card(Rank::TEN, Suit::HEART), Card(Rank::TEN, Suit::SPADE), Card(Rank::TWO, Suit::DIAMOND)); PokerGame game2(hand3, hand4); std::cout << game2; if (game2.hasWinner()) { if (game2.getWinner() != hand3) { std::cerr << "incorrect hand won" << std::endl; status = false; } } else { std::cerr << "hand failed to determine winner" << std::endl; status = false; } return status; }
bool PokerTest::fullHouseTest() { bool status = true; std::cout << "full house test" << std::endl; Hand hand1(Card(Rank::TEN, Suit::SPADE), Card(Rank::TEN, Suit::HEART), Card(Rank::TEN, Suit::DIAMOND), Card(Rank::FOUR, Suit::SPADE), Card(Rank::FOUR, Suit::DIAMOND)); Hand hand2(Card(Rank::NINE, Suit::HEART), Card(Rank::NINE, Suit::CLUB), Card(Rank::NINE, Suit::SPADE), Card(Rank::ACE, Suit::HEART), Card(Rank::ACE, Suit::CLUB)); PokerGame game1(hand1, hand2); std::cout << game1; if (game1.hasWinner()) { if (game1.getWinner() != hand1) { std::cerr << "incorrect hand won" << std::endl; status = false; } } else { std::cerr << "hand failed to determine winner" << std::endl; status = false; } Hand hand3(Card(Rank::ACE, Suit::SPADE), Card(Rank::ACE, Suit::CLUB), Card(Rank::ACE, Suit::HEART), Card(Rank::FOUR, Suit::DIAMOND), Card(Rank::FOUR, Suit::CLUB)); Hand hand4(Card(Rank::ACE, Suit::SPADE), Card(Rank::ACE, Suit::HEART), Card(Rank::ACE, Suit::DIAMOND), Card(Rank::THREE, Suit::SPADE), Card(Rank::THREE, Suit::DIAMOND)); PokerGame game2(hand3, hand4); std::cout << game2; if (game2.hasWinner()) { if (game2.getWinner() != hand3) { std::cerr << "incorrect hand won" << std::endl; status = false; } } else { std::cerr << "hand failed to determine winner" << std::endl; status = false; } return status; }
void video(int x,int y,int p) { setcolor(WHITE); /* ellipse(x,y,140,40,25,25); rectangle(x-20,y-20,x+20,y-16); line(x-20,y-20,x-25,y-35); line(x+20,y-20,x+25,y-35); line(x-25,y-35,x-10,y-25); line(x+25,y-35,x+10,y-25); line(x-10,y-25,x,y-35); line(x+10,y-25,x,y-35); circle(x-8,y-7,3); circle(x+8,y-7,3); line(x,y-6,x-3,y+3); line(x-3,y+3,x+1,y+3); ellipse(x,y+5,180,360,10,10); line(x-50,y+25,x+50,y+25); line(x-50,y+25,x-75,y+65); line(x-40,y+50,x-75,y+100); line(x-40,y+50,x-35,y+125); line(x+50,y+25,x+75,y+75); line(x+40,y+50,x+55,y+75); line(x+55,y+75,x+36,y+110); line(x+75,y+75,x+36,y+130); line(x+40,y+50,x+35,y+125); line(x-35,y+125,x+35,y+125); line(x-35,y+125,x-40,y+225); line(x+35,y+125,x+40,y+225); line(x-40,y+225,x+40,y+225); ellipse(x-250,y-25,316,346,300,200); ellipse(x-275,y-25,323,346,300,200);*/ x=x-75; y=y+65; line(x,y,x,y+35); line(x,y,x,y+35); x=x+75; y=y-65; /* setfillstyle(SOLID_FILL,RED); floodfill(x,y-30,WHITE); setfillstyle(SOLID_FILL,12); floodfill(x,y,WHITE); setfillstyle(SOLID_FILL,BLUE); floodfill(x,y+45,WHITE); setfillstyle(SOLID_FILL,GREEN); floodfill(x,y+65,WHITE); setfillstyle(SOLID_FILL,BLUE); floodfill(x,y+100,WHITE); setfillstyle(SOLID_FILL,BROWN); floodfill(x,y+150,WHITE);*/ x=x-75; y=y+65; if(p==0) { hand3(x,y,92,30); hand(x,y,92,30); } else hand2(x,y,92,30); }
bool PokerTest::straightFlushTest() { bool status = true; std::cout << "straight flush test" << std::endl; Hand hand1(Card(Rank::EIGHT, Suit::HEART), Card(Rank::SEVEN, Suit::HEART), Card(Rank::SIX, Suit::HEART), Card(Rank::FIVE, Suit::HEART), Card(Rank::FOUR, Suit::HEART)); Hand hand2(Card(Rank::SIX, Suit::SPADE), Card(Rank::FIVE, Suit::SPADE), Card(Rank::FOUR, Suit::SPADE), Card(Rank::THREE, Suit::SPADE), Card(Rank::TWO, Suit::SPADE)); PokerGame game1(hand1, hand2); std::cout << game1; if (game1.hasWinner()) { if (game1.getWinner() != hand1) { std::cerr << "incorrect hand won" << std::endl; status = false; } } else { std::cerr << "hand failed to determine winner" << std::endl; status = false; } Hand hand3(Card(Rank::JACK, Suit::CLUB), Card(Rank::TEN, Suit::CLUB), Card(Rank::NINE, Suit::CLUB), Card(Rank::EIGHT, Suit::CLUB), Card(Rank::SEVEN, Suit::CLUB)); Hand hand4(Card(Rank::JACK, Suit::DIAMOND), Card(Rank::TEN, Suit::DIAMOND), Card(Rank::NINE, Suit::DIAMOND), Card(Rank::EIGHT, Suit::DIAMOND), Card(Rank::SEVEN, Suit::DIAMOND)); PokerGame game2(hand3, hand4); std::cout << game2; if (game2.hasWinner()) { std::cerr << "hand failed to determine tie" << std::endl; status = false; } return status; }
void main() { int gdriver = DETECT, gmode; initgraph(&gdriver, &gmode, "\\tc\\bgi"); cleardevice(); char name[30]={"ch1"}; king(name); hand3(375,215,92,30); int Mstatus = initmouse(); int button,m,n,slot; int z=0; settextstyle(2,0,4); outtextxy(230,130,"LOADING"); /* outtextxy(220,165,"Slot 1"); // rectangle(215,164,300,177); // rectangle(215,179,300,192); // rectangle(215,194,300,207); rectangle(215,209,300,222); rectangle(215,224,300,237); rectangle(215,239,300,252); rectangle(215,254,300,267); rectangle(215,269,300,282); rectangle(215,284,300,297); outtextxy(220,180,"Slot 2"); outtextxy(220,195,"Slot 3"); outtextxy(220,210,"Slot 4"); outtextxy(220,225,"Slot 5"); outtextxy(220,240,"Slot 6"); outtextxy(220,255,"Slot 7"); outtextxy(220,270,"Slot 8"); outtextxy(220,285,"Slot 9"); outtextxy(220,300,"Slot 10"); */ if(Mstatus == 0 ) outtextxy(50,50, "Mouse Support Not Available"); // changecursor(cursor); while(!kbhit()) { showmouseptr(); getmousepos(&button,&m,&n); if(m>245 && m<325 && n>320 && n<332) { setcolor(RED); outtextxy(250,320,"BACK"); } else { setcolor(WHITE); outtextxy(250,320,"BACK"); if(m>215 && m<300 && n>164 && n<177) { setcolor(RED); outtextxy(220,165,"Slot 1"); } else { setcolor(WHITE); outtextxy(220,165,"Slot 1"); if(m>215 && m<300 && n>179 && n<192) { setcolor(RED); outtextxy(220,180,"Slot 2"); } else { setcolor(WHITE); outtextxy(220,180,"Slot 2"); if(m>215 && m<300 && n>194 && n<207) { setcolor(RED); outtextxy(220,195,"Slot 3"); } else { setcolor(WHITE); outtextxy(220,195,"Slot 3"); if(m>215 && m<300 && n>209 && n<222) { setcolor(RED); outtextxy(220,210,"Slot 4"); } else { setcolor(WHITE); outtextxy(220,210,"Slot 4"); if(m>215 && m<300 && n>224 && n<237) { setcolor(RED); outtextxy(220,225,"Slot 5"); } else { setcolor(WHITE); outtextxy(220,225,"Slot 5"); if(m>215 && m<300 && n>239 && n<252) { setcolor(RED); outtextxy(220,240,"Slot 6"); } else { setcolor(WHITE); outtextxy(220,240,"Slot 6"); if(m>215 && m<300 && n>254 && n<267) { setcolor(RED); outtextxy(220,255,"Slot 7"); } else { setcolor(WHITE); outtextxy(220,255,"Slot 7"); if(m>215 && m<300 && n>269 && n<282) { setcolor(RED); outtextxy(220,270,"Slot 8"); } else { setcolor(WHITE); outtextxy(220,270,"Slot 8"); if(m>215 && m<300 && n>284 && n<297) { setcolor(RED); outtextxy(220,285,"Slot 9"); } else { setcolor(WHITE); outtextxy(220,285,"Slot 9"); if(m>215 && m<300 && n>299 && n<312) { setcolor(RED); outtextxy(220,300,"Slot 10"); } else { setcolor(WHITE); outtextxy(220,300,"Slot 10"); }}}}}}}}}}} if(button == 1) { if(m>245 && m<325 && n>320 && n<332) { hidemouseptr(); video(450,150,0); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>164 && n<177) { hidemouseptr(); video(450,150,0); slot=1; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>179 && n<192) { hidemouseptr(); video(450,150,0); slot=2; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>194 && n<207) { hidemouseptr(); video(450,150,0); slot=3; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>209 && n<222) { hidemouseptr(); video(450,150,0); slot=4; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>224 && n<237) { hidemouseptr(); video(450,150,0); slot=5; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>239 && n<252) {hidemouseptr(); video(450,150,0); slot=6; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>254 && n<267) {hidemouseptr(); video(450,150,0); slot=7; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>269 && n<282) {hidemouseptr(); video(450,150,0); slot=8; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>284 && n<297) {hidemouseptr(); video(450,150,0); slot=9; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); } if(m>215 && m<300 && n>299 && n<312) {hidemouseptr(); video(450,150,0); slot=10; save(slot); spawnl(P_WAIT,"h:\\exe\\menu1.exe", NULL); exit(0); }}} }
bool PokerTest::twoPairTest() { bool status = true; std::cout << "two pair test" << std::endl; Hand hand1(Card(Rank::KING, Suit::HEART), Card(Rank::KING, Suit::DIAMOND), Card(Rank::TWO, Suit::CLUB), Card(Rank::TWO, Suit::DIAMOND), Card(Rank::JACK, Suit::HEART)); Hand hand2(Card(Rank::JACK, Suit::DIAMOND), Card(Rank::JACK, Suit::SPADE), Card(Rank::TEN, Suit::SPADE), Card(Rank::TEN, Suit::CLUB), Card(Rank::NINE, Suit::SPADE)); PokerGame game1(hand1, hand2); std::cout << game1; if (game1.hasWinner()) { if (game1.getWinner() != hand1) { std::cerr << "incorrect hand won" << std::endl; status = false; } } else { std::cerr << "hand failed to determine winner" << std::endl; status = false; } Hand hand3(Card(Rank::NINE, Suit::CLUB), Card(Rank::NINE, Suit::DIAMOND), Card(Rank::SEVEN, Suit::DIAMOND), Card(Rank::SEVEN, Suit::SPADE), Card(Rank::SIX, Suit::HEART)); Hand hand4(Card(Rank::NINE, Suit::HEART), Card(Rank::NINE, Suit::SPADE), Card(Rank::FIVE, Suit::HEART), Card(Rank::FIVE, Suit::DIAMOND), Card(Rank::KING, Suit::CLUB)); PokerGame game2(hand3, hand4); std::cout << game2; if (game2.hasWinner()) { if (game2.getWinner() != hand3) { std::cerr << "incorrect hand won" << std::endl; status = false; } } else { std::cerr << "hand failed to determine winner" << std::endl; status = false; } Hand hand5(Card(Rank::FOUR, Suit::SPADE), Card(Rank::FOUR, Suit::CLUB), Card(Rank::THREE, Suit::SPADE), Card(Rank::THREE, Suit::HEART), Card(Rank::KING, Suit::DIAMOND)); Hand hand6(Card(Rank::FOUR, Suit::HEART), Card(Rank::FOUR, Suit::DIAMOND), Card(Rank::THREE, Suit::DIAMOND), Card(Rank::THREE, Suit::CLUB), Card(Rank::TEN, Suit::SPADE)); PokerGame game3(hand5, hand6); std::cout << game3; if (game3.hasWinner()) { if (game3.getWinner() != hand5) { std::cerr << "incorrect hand won" << std::endl; status = false; } } else { std::cerr << "hand failed to determine winner" << std::endl; status = false; } return status; }