Advertisement
medal893

The BlackJack Ver0.9.2

Nov 11th, 2016
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 15.02 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include"poker_element.h"
  4. using namespace std;
  5. int main()
  6. {
  7.    
  8.     //Basic setting
  9.     initial();
  10.     shuffle(10000);
  11.     shuffle(10000);
  12.     shuffle(10000);
  13.     shuffle(10000);
  14.     // Player2 Start  
  15.     // endllise the Player1's amounts
  16.     int Player1_card_keep;
  17.     int Player1_card_score;
  18.     int Player1_card_A;
  19.     char Player1_card_wantYN;
  20.     int Player1_servied;
  21.     // set the int and char's value
  22.     Player1_card_keep=0;
  23.     Player1_card_score=0;
  24.     Player1_card_A=0;
  25.     Player1_card_wantYN='y';
  26.     Player1_servied=0;
  27.  
  28.    
  29.     char Explain;
  30.     cout<<"Show out the Explain of this programe?(y/n)";
  31.     cin>>Explain;
  32.     if(Explain=='y'){
  33.         cout<<"The Poker Ver0.9.2."<<endl;
  34.         cout<<"The program would auto cancel your move while your point is >=21 even if you say keep draw."<<endl;
  35.         cout<<"Show the Message about HackMode?(y/n)";
  36.         cin>>Explain;
  37.         if(Explain=='y'){
  38.             cout<<"HackMode is a Mode for this programe that could help you cheat or Edit by hand without luck."<<endl;
  39.             cout<<"It would ask you to Enable it or not later. But it is not such easy to enable actually."<<endl;
  40.             cout<<"Hope you had a good luck"<<endl;
  41.         }
  42.     }
  43.    
  44.    
  45.    
  46.    
  47.     char HackMode;
  48.     int HackMode_use;
  49.     HackMode=0;
  50.     HackMode_use=0;
  51.     cout<<"Enable the Hack mode?(y/n)";
  52.     cin>>HackMode;
  53.    
  54.     if(HackMode=='a'){
  55.         cout<<"Warring! This is not yet done! Are you sure to enable it?(y/n)";
  56.         cin>>HackMode;
  57.         if(HackMode=='b'){
  58.             HackMode_use=1;
  59.             cout<<"The Player2's HackMode had bugs that would crash the whole programe.It can't be use anyway now."<<endl;
  60.         }
  61.     }
  62.  
  63.         cout<<"Show out the cards?(y/n)";
  64.         cin>>HackMode;
  65.         if(HackMode=='y'){
  66.             display_allcard();
  67.         }
  68.        
  69.    
  70.     cout<<"Let's start!"<<endl;
  71.     cout<<"Start draw!!"<<endl;
  72.     // first draw
  73.     while(Player1_card_wantYN== 'y')
  74.     {
  75.         Player1_card_keep=draw(1);
  76.         Player1_card_keep=Player1_card_keep%13;
  77.         Player1_card_keep=Player1_card_keep+1;
  78.         cout<<"Player1 get ";
  79.         cout<<Player1_card_keep;
  80.         if(Player1_card_keep>10)
  81.         {
  82.             Player1_card_keep=10;
  83.         }
  84.         if(Player1_card_keep==1)
  85.         {
  86.             Player1_card_A=Player1_card_A+1;
  87.             Player1_card_keep=11;
  88.         }
  89.         Player1_card_score=Player1_card_score+Player1_card_keep;
  90.        
  91.         cout<<""<<endl;
  92.         if(Player1_card_score>21)
  93.         {
  94.             if(Player1_card_A>=1)
  95.             {
  96.                 Player1_card_score=Player1_card_score-10;
  97.                 Player1_card_A=Player1_card_A-1;
  98.             }
  99.         }
  100.        
  101.         cout<<"Player1's point is now ";
  102.         cout<<Player1_card_score;
  103.         cout<<""<<endl;
  104.        
  105.        
  106.         cout<<"Continute to get card?(Y/n)";
  107.         cin>>Player1_card_wantYN;
  108.         cout<<""<<endl;
  109.        
  110.         //The check for player score >=21
  111.         if(Player1_card_score==21)
  112.         {
  113.             cout<<"Your point is already the max 21, You shall not keep draw";
  114.             Player1_card_wantYN='N';
  115.         }
  116.    
  117.         if(Player1_card_score>21){
  118.             cout<<"You already higher than 21, Please not keep draw.";
  119.             Player1_card_wantYN='N';
  120.         }
  121.     }
  122.     //Hack mode message
  123.     if(HackMode_use==1){
  124.         cout<< ""<<endl;
  125.         cout<<"Hack Messager"<<endl;
  126.         cout<<"-----------------------"<<endl;
  127.         cout<<"Let you keep get card?(y/n)"<<endl;
  128.         cin>>HackMode;
  129.         if(HackMode== 'y'){
  130.            
  131.             Player1_card_wantYN=1;
  132.          }
  133.         else{
  134.             cout<<"Keep the value"<<endl;
  135.         }
  136.         cout<<"Edit the final Point direct?(y/n)"<<endl;
  137.         cin>>HackMode;
  138.         if(HackMode=='y'){
  139.             cout<<"Please key in the value you want to let it be.";
  140.             cin>>HackMode;
  141.             Player1_card_score=HackMode;
  142.         }
  143.         cout<<"-----------------------"<<endl;
  144.     }  
  145.        
  146.  
  147. /*      cout<<Player1_card_wantYN;
  148.         cout<<""<<endl; */
  149.  
  150.         //show out message
  151.         // do not have to do after the Check score>=21 done write
  152. /*  cout<<"The check of the pick"<<endl;
  153.     cout<<"Amount of Player The Basic card    ";
  154.     cout<<Player1_card_score<<endl;
  155.     cout<<"Amount of Player1's A   ";
  156.     cout<<Player1_card_A<<endl;  */
  157.     //end check
  158.    
  159.    
  160.     cout<<"Here is player1's card!!"<<endl;
  161.     display_player_card(1);
  162.     cout<<"This is Player1's card Sum!!"<<endl;
  163.     cout<<Player1_card_score<<endl;
  164.     if(Player1_card_score<=21)
  165.     {
  166.         cout<<"Player1 had not died!"<<endl;
  167.     }
  168.     else
  169.     {
  170.         cout<<"Player1 lose!"<<endl;
  171.         Player1_servied=1;
  172.     }
  173.     system("pause");
  174.  
  175.     // Player1 End
  176.  
  177.     // Player2 Start
  178.     // endllise the Player2's amounts
  179.     int Player2_card_keep;
  180.     int Player2_card_score;
  181.     int Player2_card_A;
  182.     char Player2_card_wantYN;
  183.     int Player2_servied;  
  184.     // set the int and char's value
  185.     Player2_card_keep=0;
  186.     Player2_card_score=0;
  187.     Player2_card_A=0;
  188.     Player2_card_wantYN='y';
  189.     Player2_servied=0;
  190.  
  191.     while(Player2_card_wantYN== 'y'){
  192.         Player2_card_keep=draw(1);
  193.         Player2_card_keep=Player2_card_keep%13;
  194.         Player2_card_keep=Player2_card_keep+1;
  195.         cout<<"Player2 get ";
  196.         cout<<Player2_card_keep;
  197.         if(Player2_card_keep>10){
  198.             Player2_card_keep=10;
  199.         }
  200.         if(Player2_card_keep==1){
  201.             Player2_card_A=Player2_card_A+1;
  202.             Player2_card_keep=11;
  203.         }
  204.         Player2_card_score=Player2_card_score+Player2_card_keep;
  205.        
  206.         cout<<""<<endl;
  207.         if(Player2_card_score>21){
  208.             if(Player2_card_A>=1){
  209.                 Player2_card_score=Player2_card_score-10;
  210.                 Player2_card_A=Player2_card_A-1;
  211.             }
  212.         }
  213.        
  214.         cout<<"Player2's point is now ";
  215.         cout<<Player2_card_score;
  216.         cout<<""<<endl;
  217.        
  218.        
  219.         cout<<"Continute to get card?(Y/n)";
  220.         cin>>Player2_card_wantYN;
  221.         cout<<""<<endl;
  222.        
  223.         //The check for player score >=21
  224.         if(Player2_card_score==21){
  225.             cout<<"Your point is already the max 21, You shall not keep draw";
  226.             Player2_card_wantYN='N';
  227.         }
  228.         if(Player2_card_score>21){
  229.             cout<<"You already higher than 21, Please not keep draw.";
  230.             Player2_card_wantYN='N';
  231.         }
  232.     }
  233.  
  234. /*
  235.     //Hack mode message
  236.     if(HackMode_use==1){
  237.         cout<< ""<<endl;
  238.  
  239.     cout<<"Hack Messager"<<endl;
  240.     cout<<"-----------------------"<<endl;
  241.     cout<<"Let you keep get card?(y/n)"<<endl;
  242.     cin>>HackMode;
  243.     if(HackMode== 'y'){
  244.         Player2_card_wantYN=1;
  245.     }
  246.     else{
  247.         cout<<"Keep the value"<<endl;
  248.     }
  249.         cout<<"Edit the final Point direct?(y/n)"<<endl;
  250.         cin>>HackMode;
  251.         if(HackMode=='y'){
  252.             cout<<"Please key in the value you want to let it be.";
  253.             cin>>HackMode;
  254.             Player2_card_score=HackMode;
  255.         }
  256.         cout<<"-----------------------"<<endl;*/
  257.  
  258.  
  259.  
  260.  
  261.  
  262. /*      cout<<Player2_card_wantYN;
  263.         cout<<""<<endl; */
  264.    
  265.         //show out message
  266.         // do not have to do after the Check score>=21 done write
  267. /*  cout<<"The check of the pick"<<endl;
  268.     cout<<"Amount of Player The Basic card    ";
  269.     cout<<Player2_card_score<<endl;
  270.     cout<<"Amount of Player2's A   ";
  271.     cout<<Player2_card_A<<endl;  */
  272.     //end check
  273.    
  274.    
  275.     cout<<"Here is Player2's card!!"<<endl;
  276.     display_player_card(2);
  277.     cout<<"This is Player2's card Sum!!"<<endl;
  278.     cout<<Player2_card_score<<endl;
  279.     if(Player2_card_score<=21)
  280.     {
  281.         cout<<"Player2 had not died!"<<endl;
  282.     }
  283.     else
  284.     {
  285.         cout<<"Player2 lose!"<<endl;
  286.         Player2_servied=1;
  287.     }
  288.     system("pause");
  289.  
  290.  
  291. // Player2's game end.
  292.  
  293. // Player3 Start
  294.     // endllise the Player3's amounts
  295.     int Player3_card_keep;
  296.     int Player3_card_score;
  297.     int Player3_card_A;
  298.     char Player3_card_wantYN;
  299.     int Player3_servied;
  300.     // set the int and char's value
  301.     Player3_card_keep=0;
  302.     Player3_card_score=0;
  303.     Player3_card_A=0;
  304.     Player3_card_wantYN='y';
  305.     Player3_servied=0;
  306.  
  307.  
  308.     while(Player3_card_wantYN== 'y'){
  309.         Player3_card_keep=draw(1);
  310.         Player3_card_keep=Player3_card_keep%13;
  311.         Player3_card_keep=Player3_card_keep+1;
  312.         cout<<"Player3 get ";
  313.         cout<<Player3_card_keep;
  314.         if(Player3_card_keep>10)
  315.         {
  316.             Player3_card_keep=10;
  317.         }
  318.         if(Player3_card_keep==1)
  319.         {
  320.             Player3_card_A=Player3_card_A+1;
  321.             Player3_card_keep=11;
  322.         }
  323.         Player3_card_score=Player3_card_score+Player3_card_keep;
  324.        
  325.         cout<<""<<endl;
  326.         if(Player3_card_score>21)
  327.         {
  328.             if(Player3_card_A>=1)
  329.             {
  330.                 Player3_card_score=Player3_card_score-10;
  331.                 Player3_card_A=Player3_card_A-1;
  332.             }
  333.         }
  334.        
  335.         cout<<"Player3's point is now ";
  336.         cout<<Player3_card_score;
  337.         cout<<""<<endl;
  338.        
  339.        
  340.         cout<<"Continute to get card?(Y/n)";
  341.         cin>>Player3_card_wantYN;
  342.         cout<<""<<endl;
  343.        
  344.         //The check for player score >=21
  345.         if(Player3_card_score==21)
  346.         {
  347.             cout<<"Your point is already the max 21, You shall not keep draw";
  348.             Player3_card_wantYN='N';
  349.         }
  350.         if(Player3_card_score>21){
  351.             cout<<"You already higher than 21, Please not keep draw.";
  352.             Player3_card_wantYN='N';
  353.         }
  354.     }
  355.     //Hack mode message
  356.     if(HackMode_use==1){
  357.         cout<< ""<<endl;
  358.         cout<<"Hack Messager"<<endl;
  359.         cout<<"-----------------------"<<endl;
  360.         cout<<"Let you keep get card?(y/n)"<<endl;
  361.         cin>>HackMode;
  362.         if(HackMode== 'y'){
  363.            
  364.             Player1_card_wantYN='y';
  365.          }
  366.         else{
  367.             cout<<"Keep the value"<<endl;
  368.         }
  369.         cout<<"Edit the final Point direct?(y/n)"<<endl;
  370.         cin>>HackMode;
  371.         if(HackMode=='y'){
  372.             cout<<"Please key in the value you want to let it be.";
  373.             cin>>HackMode;
  374.             Player1_card_score=HackMode;
  375.         }
  376.         cout<<"-----------------------"<<endl;
  377.     }    
  378. /*      cout<<Player3_card_wantYN;
  379.         cout<<""<<endl; */
  380.  
  381.         //show out message
  382.         // do not have to do after the Check score>=21 done write
  383. /*  cout<<"The check of the pick"<<endl;
  384.     cout<<"Amount of Player The Basic card    ";
  385.     cout<<Player3_card_score<<endl;
  386.     cout<<"Amount of Player3's A   ";
  387.     cout<<Player3_card_A<<endl;  */
  388.     //end check
  389.    
  390.    
  391.     cout<<"Here is Player3's card!!"<<endl;
  392.     display_player_card(3);
  393.     cout<<"This is Player3's card Sum!!"<<endl;
  394.     cout<<Player3_card_score<<endl;
  395.     if(Player3_card_score<=21)
  396.     {
  397.         cout<<"Player3 had not died!"<<endl;
  398.     }
  399.     else
  400.     {
  401.         cout<<"Player3 lose!"<<endl;
  402.         Player3_servied=1;
  403.     }
  404.     system("pause");
  405.  
  406.  
  407. // Player3's game end.
  408.  
  409. // Player4 Start
  410.     // endllise the Player4's amounts
  411.     int Player4_card_keep;
  412.     int Player4_card_score;
  413.     int Player4_card_A;
  414.     int Player4_servied;
  415.     char Player4_card_wantYN;
  416.     // set the int and char's value
  417.     Player4_card_keep=0;
  418.     Player4_card_score=0;
  419.     Player4_card_A=0;
  420.     Player4_card_wantYN='y';
  421.     Player4_servied=0;
  422.  
  423.     while(Player4_card_wantYN== 'y')
  424.     {
  425.         Player4_card_keep=draw(1);
  426.         Player4_card_keep=Player4_card_keep%13;
  427.         Player4_card_keep=Player4_card_keep+1;
  428.         cout<<"Player4 get ";
  429.         cout<<Player4_card_keep;
  430.         if(Player4_card_keep>10)
  431.         {
  432.             Player4_card_keep=10;
  433.         }
  434.         if(Player4_card_keep==1)
  435.         {
  436.             Player4_card_A=Player4_card_A+1;
  437.             Player4_card_keep=11;
  438.         }
  439.         Player4_card_score=Player4_card_score+Player4_card_keep;
  440.        
  441.         cout<<""<<endl;
  442.         if(Player4_card_score>21)
  443.         {
  444.             if(Player4_card_A>=1)
  445.             {
  446.                 Player4_card_score=Player4_card_score-10;
  447.                 Player4_card_A=Player4_card_A-1;
  448.             }
  449.         }
  450.        
  451.         cout<<"Player4's point is now ";
  452.         cout<<Player4_card_score;
  453.         cout<<""<<endl;
  454.        
  455.        
  456.         cout<<"Continute to get card?(Y/n)";
  457.         cin>>Player4_card_wantYN;
  458.         cout<<""<<endl;
  459.        
  460.         //The check for player score >=21
  461.         if(Player4_card_score==21)
  462.         {
  463.             cout<<"Your point is already the max 21, You shall not keep draw";
  464.             Player4_card_wantYN='N';
  465.         }
  466.         if(Player4_card_score>21){
  467.             cout<<"You already higher than 21, Please not keep draw.";
  468.             Player4_card_wantYN='N';
  469.             Player4_servied=1;        
  470.         }
  471.     }
  472.     //Hack mode message
  473.     if(HackMode_use==1){
  474.         cout<< ""<<endl;
  475.         cout<<"Hack Messager"<<endl;
  476.         cout<<"-----------------------"<<endl;
  477.         cout<<"Let you keep get card?(y/n)"<<endl;
  478.         cin>>HackMode;
  479.         if(HackMode== 'y'){
  480.            
  481.             Player1_card_wantYN=1;
  482.          }
  483.         else{
  484.             cout<<"Keep the value"<<endl;
  485.         }
  486.         cout<<"Edit the final Point direct?(y/n)"<<endl;
  487.         cin>>HackMode;
  488.         if(HackMode=='y'){
  489.             cout<<"Please key in the value you want to let it be.";
  490.             cin>>HackMode;
  491.             Player1_card_score=HackMode;
  492.         }
  493.         cout<<"-----------------------"<<endl;
  494.     }    
  495.  
  496.        
  497.  
  498. /*      cout<<Player4_card_wantYN;
  499.         cout<<""<<endl; */
  500.  
  501.         //show out message
  502.         // do not have to do after the Check score>=21 done write
  503. /*  cout<<"The check of the pick"<<endl;
  504.     cout<<"Amount of Player The Basic card    ";
  505.     cout<<Player4_card_score<<endl;
  506.     cout<<"Amount of Player4's A   ";
  507.     cout<<Player4_card_A<<endl;  */
  508.     //end check
  509.    
  510.    
  511.     cout<<"Here is Player4's card!!"<<endl;
  512.     display_player_card(4);
  513.     cout<<"This is Player4's card Sum!!"<<endl;
  514.     cout<<Player4_card_score<<endl;
  515.     if(Player4_card_score<=21)
  516.     {
  517.         cout<<"Player4 had not died!"<<endl;
  518.        
  519.     }
  520.     else
  521.     {
  522.         cout<<"Player4 lose!"<<endl;
  523.         Player4_servied=1;
  524.     }
  525.     system("pause");
  526.  
  527.  
  528. // Player4's game end.
  529.  
  530.  
  531. //start the end.
  532.     cout<<"The report for the whole game."<<endl;
  533.     cout<<"Player1:"<<Player1_card_score<<endl;
  534.     if( Player1_servied==1){
  535.         cout<<"Player1 servied."<<endl;
  536.     }
  537.     else
  538.     {
  539.         cout<<"Player1 died."<<endl;
  540.     }
  541.     cout<<"Player2:"<<Player2_card_score<<endl;
  542.  
  543.     if( Player2_servied==1){
  544.         cout<<"Player2 servied."<<endl;
  545.     }
  546.     else
  547.     {
  548.         cout<<"Player2 died."<<endl;
  549.     }
  550.     cout<<"Player3:"<<Player3_card_score<<endl;
  551.  
  552.     if( Player3_servied==1){
  553.         cout<<"Player3 servied."<<endl;
  554.     }
  555.     else
  556.     {
  557.         cout<<"Player3 died."<<endl;
  558.     }
  559.     cout<<"Player4:"<<Player4_card_score<<endl;
  560.     if( Player4_servied==1){
  561.         cout<<"Player4 servied."<<endl;
  562.     }  
  563.     else
  564.     {
  565.         cout<<"Player4 died."<<endl;
  566.     }
  567. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement