SHARE
TWEET

The BlackJack Ver0.9

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