medal893

The BlackJake Ver0.12.

Dec 21st, 2016
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.88 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include"poker_element.h"
  4. #define PLAYER 8
  5. using namespace std;
  6. //void AI(int *);
  7. int main()
  8. {
  9. //Basic setting
  10. initial();
  11. shuffle(10000);
  12. shuffle(10000);
  13. shuffle(10000);
  14. shuffle(10000);
  15. // Player2 Start
  16. // endllise the Player1's amounts
  17. int Card_keep_Player[PLAYER];
  18. int Card_score_Player[PLAYER];
  19. int Card_A_Player[PLAYER];
  20. char Card_wantYN_Player[PLAYER];
  21. int Card_servied_Player[PLAYER];
  22. int AI[PLAYER];
  23. // Hack Mode ints
  24. char HackMode;
  25. int HackMode_use;
  26. int Player_Amount;
  27. char ai;
  28. int ai_pos[PLAYER];
  29. int ai_select;
  30. //Int the For cycle
  31. int for_cycle;
  32. for_cycle=1;
  33. int f;
  34.  
  35. // set the int and char's value
  36. for(f=0;f<=PLAYER;f++){
  37. Card_keep_Player[f]=0;
  38. Card_score_Player[f]=0;
  39. Card_A_Player[f]=0;
  40. Card_wantYN_Player[f]='y';
  41. Card_servied_Player[f]=0;
  42. ai_pos[f]=0;
  43. }
  44.  
  45. char Explain;
  46. cout<<"This Version is a Dev Version, Comform you not to use this Version!!"<<endl;
  47.  
  48. cout<<"Show out the Explain of this programe?(y/n)";
  49. cin>>Explain;
  50. if(Explain=='y'){
  51. cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
  52. cout<<endl<<endl<<"The Poker Ver0.12."<<endl;
  53. cout<<"The program would auto cancel your move while your point is >=21 even if you say keep draw."<<endl;
  54. cout<<"Show the Message about HackMode?(y/n)";
  55. cin>>Explain;
  56. if(Explain=='y'){
  57. cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
  58. cout<<endl<<endl<<"HackMode is a Mode for this programe that could help you cheat or Edit by hand without luck."<<endl;
  59. cout<<"It would ask you to Enable it or not later. But it is not such easy to enable actually."<<endl;
  60. cout<<"Hope you had a good luck"<<endl;
  61. }
  62. cout<<"Show out the Upgrade message?(y/n)";
  63. cin>>Explain;
  64. if(Explain=='y'){
  65. cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
  66. cout<<endl<<endl<<"Ver0.12 / Upgrade for AI"<<endl;
  67. cout<<"The program had basicist AI now but it still had bugs that if you choose to have an AI all player would become an AI"<<endl<<"And AI's knowledge of danger=deped had not yet done, so it had vary high percent died easily"<<endl;
  68. }
  69. else{
  70. cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
  71. }
  72. }
  73. else{
  74. cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
  75. }
  76. HackMode=0;
  77. HackMode_use=0;
  78. cout<<"Enable the Hack mode?(y/n)";
  79. cin>>HackMode;
  80. cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
  81. if(HackMode=='a'){
  82. cout<<"Warring! This is not yet done! Are you sure to enable it?(y/n)";
  83. cin>>HackMode;
  84. if(HackMode=='b'){
  85. HackMode_use=1;
  86. }
  87. }
  88.  
  89. cout<<"Show out the cards?(y/n)";
  90. cin>>HackMode;
  91. if(HackMode=='y'){
  92. display_allcard();
  93. }
  94. cout<<"Please key in the Player Amount(1~8 Avliable now)";
  95. cin>>Player_Amount;
  96. cout<<endl<<"You choose "<<Player_Amount<<" Player"<<endl;
  97.  
  98. // About AI
  99. if(Player_Amount>=2){
  100.  
  101. cout<<"Instill an AI in Game?(y/n)";
  102. cin>>ai;
  103. if(ai='y'){
  104. cout<<endl<<"You choose instill 1 AI inside game, Please choose which Player would be AI"<<endl;
  105. cout<<"Player";
  106. cin>>ai_select;
  107. for(f=0;f<8;f++){
  108. ai_pos[f]=0;
  109. cout<<f<<"=0"<<endl;
  110. }
  111. if(ai_select=0){
  112. ai_pos[0]=1;
  113. }
  114. else if(ai_select=1){
  115. ai_pos[1]=1;
  116. }
  117. else if(ai_select=2){
  118. ai_pos[2]=1;
  119. }
  120. else if(ai_select=3){
  121. ai_pos[3]=1;
  122. }
  123. else if(ai_select=4){
  124. ai_pos[4]=1;
  125. }
  126. else if(ai_select=5){
  127. ai_pos[5]=1;
  128. }
  129. else if(ai_select=6){
  130. ai_pos[6]=1;
  131. }
  132. else if(ai_select=7){
  133. ai_pos[7]=1;
  134. }
  135. }
  136. }
  137.  
  138. for(f=0;f<Player_Amount;f++){
  139. cout<<"Let's start!"<<endl;
  140. cout<<"Start draw!!"<<endl;
  141. if(ai_pos[f]=1){
  142. cout<<"This Player is already be seen as a AI"<<endl;
  143. while(Card_wantYN_Player[f] == 'y'){
  144. Card_keep_Player[f]=draw(1);
  145. Card_keep_Player[f]=Card_keep_Player[f]%13;
  146. Card_keep_Player[f]=Card_keep_Player[f]+1;
  147. cout<<"Player"<<f<<" get ";
  148. cout<<Card_keep_Player[f];
  149. if(Card_keep_Player[f]>10)
  150. {
  151. Card_keep_Player[f]=10;
  152. }
  153. if(Card_keep_Player[f]==1)
  154. {
  155. Card_A_Player[f]=Card_A_Player[f]+1;
  156. Card_keep_Player[f]=11;
  157. }
  158. Card_score_Player[f]=Card_score_Player[f]+Card_keep_Player[f];
  159.  
  160. cout<<""<<endl;
  161. if(Card_score_Player[f]>21)
  162. {
  163. if(Card_A_Player[f]>=1)
  164. {
  165. Card_score_Player[f]=Card_score_Player[f]-10;
  166. Card_A_Player[f]=Card_A_Player[f]-1;
  167. }
  168. }
  169.  
  170. cout<<"Player"<<f<<"'s point is now ";
  171. cout<<Card_score_Player[f];
  172. cout<<""<<endl;
  173.  
  174. cout<<"Continute to get card?(Y/n)";
  175. if(Card_score_Player[f]<14){
  176. cout<<"y";
  177. Card_wantYN_Player[f]='y';
  178. }
  179. cout<<""<<endl;
  180.  
  181. //The check for player score >=21
  182. if(Card_score_Player[f]==21)
  183. {
  184. cout<<"This AI's point is already the max 21";
  185. Card_wantYN_Player[f] ='N';
  186. }
  187.  
  188. if(Card_score_Player[f]>21){
  189. cout<<"This AI's point already higher than 21.";
  190. Card_wantYN_Player[f] ='N';
  191. }
  192. }
  193. }
  194. else{
  195. while(Card_wantYN_Player[f] == 'y'){
  196. Card_keep_Player[f]=draw(1);
  197. Card_keep_Player[f]=Card_keep_Player[f]%13;
  198. Card_keep_Player[f]=Card_keep_Player[f]+1;
  199. cout<<"Player"<<f<<" get ";
  200. cout<<Card_keep_Player[f];
  201. if(Card_keep_Player[f]>10)
  202. {
  203. Card_keep_Player[f]=10;
  204. }
  205. if(Card_keep_Player[f]==1)
  206. {
  207. Card_A_Player[f]=Card_A_Player[f]+1;
  208. Card_keep_Player[f]=11;
  209. }
  210. Card_score_Player[f]=Card_score_Player[f]+Card_keep_Player[f];
  211.  
  212. cout<<""<<endl;
  213. if(Card_score_Player[f]>21)
  214. {
  215. if(Card_A_Player[f]>=1)
  216. {
  217. Card_score_Player[f]=Card_score_Player[f]-10;
  218. Card_A_Player[f]=Card_A_Player[f]-1;
  219. }
  220. }
  221.  
  222. cout<<"Player"<<f<<"'s point is now ";
  223. cout<<Card_score_Player[f];
  224. cout<<""<<endl;
  225.  
  226. cout<<"Continute to get card?(Y/n)";
  227. cin>>Card_wantYN_Player[f] ;
  228. cout<<""<<endl;
  229.  
  230. //The check for player score >=21
  231. if(Card_score_Player[f]==21)
  232. {
  233. cout<<"Your point is already the max 21, You shall not keep draw";
  234. Card_wantYN_Player[f] ='N';
  235. }
  236.  
  237. if(Card_score_Player[f]>21){
  238. cout<<"You already higher than 21, Please not keep draw.";
  239. Card_wantYN_Player[f] ='N';
  240. }
  241. }
  242. }
  243.  
  244. //Hack mode message
  245. if(HackMode_use==1){
  246. cout<< ""<<endl;
  247. cout<<"Hack Messager"<<endl;
  248. cout<<"-----------------------"<<endl;
  249. cout<<"Let you keep get card?(y/n)"<<endl;
  250. cin>>HackMode;
  251. if(HackMode== 'y'){
  252.  
  253. Card_wantYN_Player[f] =1;
  254. }
  255. else{
  256. cout<<"Keep the value"<<endl;
  257. }
  258. cout<<"Edit the final Point direct?(y/n)"<<endl;
  259. cin>>HackMode;
  260. if(HackMode=='y'){
  261. cout<<"Please key in the value you want to let it be.";
  262. cin>>HackMode;
  263. Card_score_Player[f]=HackMode;
  264. }
  265. cout<<"-----------------------"<<endl;
  266. }
  267.  
  268. cout<<"Here is Player"<<f<<"'s card!!"<<endl;
  269. display_player_card(1);
  270. cout<<"This is Player"<<f<<"s card Sum!!"<<endl;
  271. cout<<Card_score_Player[f]<<endl;
  272. if(Card_score_Player[f]<=21)
  273. {
  274. cout<<"Player"<<f<<" had not died!"<<endl;
  275. }
  276. else
  277. {
  278. cout<<"Player"<<f<<" lose!"<<endl;
  279. Card_servied_Player[f] =1;
  280. }
  281. system("pause");
  282.  
  283. // Player[f] End
  284. Card_wantYN_Player[f] ='y';
  285. }
  286.  
  287. }
Add Comment
Please, Sign In to add comment