1. ///////////////////////////////////////////////////////////
  2. // Titulo : Juego Picas y Fijas                          //
  3. // Autor : MaztoR                                         //
  4. // Blog : Maztor.blogspot.com || MaztoR [In]-Security    //
  5. // Twitter: @Mazt0r                                      //
  6. // Fecha de creacion: [04/Octubre/2012]                  //
  7. ///////////////////////////////////////////////////////////
  8.  
  9. #include <cstdlib>
  10. #include <time.h>
  11. #include <iostream>
  12. #include <windows.h>
  13. #include <conio.h>
  14.  
  15. using namespace std;
  16.  
  17. int main()
  18.  
  19. {      
  20.     //Menu
  21.     int opcionx;
  22.     //Estados del Ciclo
  23.     int status=0;
  24.     int status2=0;
  25.     // Rango Aleatorios
  26.     int r1, r2;
  27.     //Numero Generado
  28.     int numero;
  29.     //Numero Ingresao por el usuario
  30.     int num_user;
  31.     //Contadores
  32.     int contador1, contador2;
  33.     //Proceso con vectores aislamiento de cifras  
  34.     int n, residuo;
  35.     //Vectores Numero Aleatorio Generado
  36.     int agax, agax1, agax2, agax3, agax4, agax5;
  37.     int nivel1[2], nivel2[3], nivel3[5];
  38.     //Vectores Numero Aleatorio Ingresado por el usuario
  39.     int auserx, auserx1, auserx2, auserx3, auserx4, auserx5;
  40.     int iu[2], iu2[3], iu3[5];
  41.     //Picas y Fijas
  42.     int fijas=0, picas=0;
  43.     //Intentos
  44.     int intentos=0;
  45.  
  46. system( "color 70" );
  47.    
  48. //BANNER DE BIENVENIDA ASCII
  49.  
  50. Beep ( 659 , 200);
  51. Beep ( 740 , 200);
  52. Sleep (800);
  53. cout<<"\n\t\t              .,-:;//;:=,"<<endl;
  54. cout<<"\t\t          . :H@@@MM@M#H/.,+%;,"<<endl;
  55. cout<<"\t\t       ,/X+ +M@@M@MM%=,-%HMMM@X/,"<<endl;
  56. Beep ( 784 , 200);
  57. cout<<"\t\t     -+@MM; $M@@MH+-,;XMMMM@MMMM@+-"<<endl;
  58. cout<<"\t\t    ;@M@@M- XM@X;. -+XXXXXHHH@M@M#@/."<<endl;
  59. cout<<"\t\t  ,%MM@@MH ,@%=            .---=-=:=,."<<endl;
  60. Beep ( 740 , 200);
  61. cout<<"\t\t  =@#@@@MX .,              -%HX$$%%%+;"<<endl;
  62. cout<<"\t\t =-./@M@M$    PICAS Y FIJAS .;@MMMM@MM:"<<endl;
  63. cout<<"\t\t X@/ -$MM/                    .+MM@@@M$"<<endl;
  64. Beep ( 659 , 200);
  65. cout<<"\t\t,@M@H: :@:                    . =X#@@@@-"<<endl;
  66. cout<<"\t\t,@@@MMX, .                    /H- ;@M@M="<<endl;
  67. Beep ( 659 , 200);
  68. cout<<"\t\t /MMMM@MMH/.                  XM@MH; =;"<<endl;
  69. cout<<"\t\t  /%+%$XHH@$=    MAZTOR    , .H@@@@MX,"<<endl;
  70. cout<<"\t\t   .=--------.           -%H.,@@@@@MX,"<<endl;
  71. Sleep (300);
  72. Beep ( 740 , 200);
  73. cout<<"\t\t   .%MM@@@HHHXX$$$%+- .:$MMX =M@@MM%."<<endl;
  74. cout<<"\t\t     =XMMM@MM@MM#H;,-+HMM@M+ /MMMX="<<endl;
  75. cout<<"\t\t      =%@M@M#@$-.=$@MM@@@M; %M%="<<endl;
  76. Beep ( 587 , 200);
  77. cout<<"\t\t        ,:+$+-,/H#MMMMMMM@= =,"<<endl;
  78. cout<<"\t\t              =++%%%%+/:-."<<endl;
  79. Sleep (300);
  80. Beep ( 659 , 200);
  81. Beep ( 440 , 200);
  82. Sleep (2000);
  83. system("cls");
  84.  
  85.  
  86. srand(time(NULL));
  87.  
  88. //BUCLE PRINCIPAL || SE ROMPE CON EL STATUS    
  89.  
  90.     do{  
  91.      //MENU PRINCIPAL
  92.      cout<<"\t\t//////////////////////////////////////////////////"<<endl;    
  93.      cout<<"\t\t//                 Picas  y Fijas               //"<<endl;
  94.      cout<<"\t\t--------------------------------------------------"<<endl;
  95.      cout<<"\t\t//               1- Comenzar juego              //"<<endl;
  96.      cout<<"\t\t//               2- Instrucciones               //"<<endl;
  97.      cout<<"\t\t//               3- Creditos || Salir           //"<<endl;
  98.      cout<<"\t\t//////////////////////////////////////////////////\n"<<endl;
  99.      cout<<"\t\t                Seleccionar opcion: ";
  100.      cin>>opcionx;
  101.    
  102.     //BUCLE OPCIONES SUBMENUS
  103.     switch (opcionx)
  104.     {
  105.     //OPCIONES [COMENZAR JUEGO]      
  106.     case 1:
  107.          system("cls");
  108.          int subop;
  109.          
  110.          cout<<"\t\t//////////////////////////////////////////////////"<<endl;    
  111.          cout<<"\t\t//                 Picas  y Fijas               //"<<endl;
  112.          cout<<"\t\t--------------------------------------------------"<<endl;
  113.          cout<<"\t\t//               1- Facil [Padawan]             //"<<endl;
  114.          cout<<"\t\t//               2- Intermedio [Jedi]           //"<<endl;
  115.          cout<<"\t\t//               3- Dificil [Darth Vader]       //"<<endl;
  116.          cout<<"\t\t//               4- Volver al Menu              //"<<endl;
  117.          cout<<"\t\t//////////////////////////////////////////////////\n"<<endl;
  118.          cout<<"\t\t                Seleccionar opcionx: ";
  119.          cin>>subop;
  120.          
  121.          //SUBOPCIONES
  122.           switch (subop)
  123.            {
  124.            
  125.             //CASE 1 JUEGO [PRIMORDIALIDAD EN EL CODIGO]
  126.             //JUEGO // TROZO DE CODIGO DELICADO
  127.            
  128.             case 1:
  129.             system("cls");
  130.             cout<<"\t\tEres un Novatillo, el maestro yoda te entrenara!!"<<endl;
  131.             Sleep (3000);
  132.             system("cls");
  133.             Beep ( 659 , 200);
  134.             cout<<"\t\t//////////////////////////////////////////////////"<<endl;
  135.             cout<<"\t\t//                 Picas y Fijas                //"<<endl;
  136.             cout<<"\t\t--------------------------------------------------"<<endl;
  137.             cout<<"\t\t// La mision es encontrar el Numero de 3 Cifras //"<<endl;
  138.             cout<<"\t\t--------------------------------------------------"<<endl;
  139.             cout<<"\t\t//             Solo tienes 9  Intentos          //"<<endl;
  140.             cout<<"\t\t//   El maestro Yoda te tiene en entrenamiento  //"<<endl;
  141.             cout<<"\t\t--------------------------------------------------"<<endl;
  142.            
  143.             do{
  144.                 //Numero aleatorio
  145.                 status2=0;
  146.                 n=100; //Divisor
  147.                 r1 = 100;
  148.                 r2 = 999 + 1;
  149.                 numero = r1+rand()%(r2 - r1);
  150.                
  151.                 cout<<"\t\t || Numero aleatorio generado > "<<numero<<endl;
  152.                
  153.                 //Descomponer numero Dividiendo
  154.                    for (contador1=0;contador1<=2;contador1++)
  155.                    {
  156.                        nivel1[contador1] = numero/n;
  157.                        residuo = numero%n;    
  158.                        numero = residuo;
  159.                        n = n/10;
  160.                    }
  161.                
  162.                    agax=nivel1[0];  
  163.                    agax1=nivel1[1];
  164.                    agax2=nivel1[2];
  165.                    
  166.                //Descartando cifras repetidas en el numero generado
  167.                    for (contador1=0;contador1<=2;contador1++)
  168.                    {
  169.                        if(contador1>=1)
  170.                        {
  171.                                 if(agax==nivel1[contador1])
  172.                                 {
  173.                                                 status2=1;
  174.                                 }
  175.                        }
  176.                        if(contador1>=2)
  177.                        {
  178.                                 if(agax1==nivel1[contador1])
  179.                                 {
  180.                                                 status2=1;
  181.                                 }
  182.                        }
  183.                    }
  184.                 }while(status2==1);
  185.                
  186.                 //Interaccion del Usuario
  187.                
  188.                 do{
  189.                    fijas=0;
  190.                    picas=0;
  191.                    n=100;
  192.                    status2=0;
  193.              
  194.                    cout<<"\t\t ||Digite un numero de 3 cifras > ";
  195.                    cin>>num_user;
  196.                    
  197.                 //Descomponer numero Dividiendo
  198.                    for (contador1=0;contador1<3;contador1++)
  199.                    {
  200.                        iu[contador1] = num_user/n;
  201.                        residuo = num_user%n;    
  202.                        num_user = residuo;
  203.                        n = n/10;
  204.                    }
  205.                    
  206.                    auserx=iu[0];  
  207.                    auserx1=iu[1];
  208.                    auserx2=iu[2];
  209.                    
  210.                 //Descartando cifras repetidas en el numero generado
  211.                    for (contador1=0;contador1<=2;contador1++)
  212.                    {
  213.                        if(contador1>=1)
  214.                        {
  215.                                 if(auserx==iu[contador1])
  216.                                 {
  217.                                                 status2=1;
  218.                                 }
  219.                        }
  220.                        if(contador1>=2)
  221.                        {
  222.                                 if(auserx1==iu[contador1])
  223.                                 {
  224.                                                 status2=1;
  225.                                 }
  226.                        }
  227.                    }
  228.                    
  229.                    if(status2==1)
  230.                    {
  231.                         cout<<"\t\t Alerta!! has Tecleado el mismo numero mas de una vez!!"<<endl;
  232.                    }else{
  233.                          
  234.                
  235.                   //Fijas y picas
  236.                         for (contador1=0;contador1<=2;contador1++)
  237.                         {
  238.                             for(contador2=0;contador2<=2;contador2++)
  239.                             {
  240.                                          
  241.                                 if(iu[contador2]==nivel1[contador1])
  242.                                 {
  243.                                    
  244.                                     if(contador2==contador1)
  245.                                     {
  246.                                              fijas++;        
  247.                                     }else{
  248.                                              picas++;
  249.                                     }
  250.                                 }              
  251.                             }  
  252.                         }
  253.                        
  254.                  //Resultados sucesivos
  255.                         intentos++;
  256.                         cout<<"\t\t-------------------------------------------------"<<endl;
  257.                         cout<<"\t\t llevas "<<intentos<<" Intentos."<<endl;
  258.                         cout<<"\t\t Tienes "<<fijas<<" Fijas > y " <<picas<<" Picas. "<<fijas<<endl;  
  259.                        }
  260.                    if(fijas==3)
  261.                    {
  262.                              status2=0;
  263.                    }else
  264.                    {
  265.                              status2=1;
  266.                    }
  267.                    if(intentos==9)
  268.                    {
  269.                              status2=0;
  270.                    }
  271.                 }while(status2!=0);
  272.                
  273.                 //Resultados Finales
  274.                 if(fijas==3){
  275.                           system("cls");
  276.                           Sleep(1000);
  277.                                                
  278. cout<<"                                 .                            .                      ."<<endl;
  279. cout<<"                     .           ------=========---      .            ."<<endl;
  280. cout<<"                           -)----====    ,'   ,'   .                 ."<<endl;
  281. cout<<"              .                  `.  `.,;___,'                ."<<endl;
  282. cout<<"                                   |||||||||||| "<<endl;
  283. cout<<"                    _,.....------c==]""______ |,,,,,,.....____ _"<<endl;
  284. cout<<"    .      .       ____--------------------------------____-----"<<endl;
  285. cout<<"                                  ,'"",'.   `."<<endl;
  286. cout<<"         .                 -)-----====   `.   `.              LS"<<endl;
  287. cout<<"                     .           ------=========---      .            ."<<endl;
  288. cout<<"             .                               ."<<endl;
  289. Beep ( 740 , 200);
  290. Beep ( 740 , 200);
  291. Beep ( 740 , 200);
  292. Beep ( 740 , 200);
  293. Sleep(2000);
  294. system("cls");
  295. cout<<"         _____"<<endl;
  296. cout<<"       .'/L|__`."<<endl;
  297. cout<<"      | =[_]O|` |"<<endl;
  298. cout<<"      | +-------:|"<<endl;
  299. cout<<"    __:='|____`-:__        Felicitaciones la nave llego a Salvo!!"<<endl;
  300. cout<<"   ||[] ||====| []||"<<endl;
  301. cout<<"   ||[] | |=| | []||       Eres el honorable merecedor de ser un maestro jedi!!"<<endl;
  302. cout<<"   |:||_|=|U| |_||:|"<<endl;
  303. cout<<"   |:|||]_=_ =[_||:| "<<endl;
  304. cout<<"   | |||] [_][]C|| |"<<endl;
  305. cout<<"   ----------------- "<<endl;
  306. cout<<"   ||||||||||||||||| "<<endl;
  307. cout<<"  |___|   |||   |___|   "<<endl;
  308. cout<<"  `---'  |___|  `---'     "<<endl;
  309. cout<<"         `---'  "<<endl;
  310.                          
  311.                          
  312.                           intentos=0;
  313.                           Beep ( 740 , 200);
  314.                           cout<<"\n\t\tPresione enter para dirigirse al menu\n"<<endl;
  315.                           getch();
  316.                           system("cls");
  317.                 }
  318.                 if(intentos==9){
  319.                                 system("cls");
  320.                                
  321. Sleep(1000);
  322. cout<<"                                 .                            .                      ."<<endl;
  323. cout<<"                     .           ------=========---      .            ."<<endl;
  324. cout<<"                           -)----====    ,'   ,'   .                 ."<<endl;
  325. cout<<"              .                  `.  `.,;___,'                ."<<endl;
  326. cout<<"                                   |||||||||||| "<<endl;
  327. cout<<"                    _,.....------c==]""______ |,,,,,,.....____ _"<<endl;
  328. cout<<"    .      .       ____--------------------------------____-----"<<endl;
  329. cout<<"                                  ,'"",'.   `."<<endl;
  330. cout<<"         .                 -)-----====   `.   `.              LS"<<endl;
  331. cout<<"                     .           ------=========---      .            ."<<endl;
  332. cout<<"             .                               ."<<endl;
  333. Beep ( 740 , 200);
  334. Beep ( 740 , 200);
  335. Beep ( 740 , 200);
  336. Beep ( 740 , 200);
  337. Sleep(1000);
  338. system("cls");
  339. cout<<"\t\t\t      _.-^^---....,,--"<<endl;
  340. cout<<"\t\t\t  _--                  --_"<<endl;
  341. cout<<"\t\t\t  <                        >)"<<endl;
  342. cout<<"\t\t\t  |                         |"<<endl;
  343. cout<<"\t\t\t    ._                   _./"<<endl;
  344. cout<<"\t\t\t      ```--. . , ; .--'''"<<endl;
  345. cout<<"\t\t\t            | |   |"<<endl;
  346. cout<<"\t\t\t         .-=||  | |=-."<<endl;
  347. cout<<"\t\t\t         `-=#$%&%$#=-'"<<endl;
  348. cout<<"\t\t\t            | ;  :|"<<endl;
  349. cout<<"\t\t\t   _____.,-#%&$@%#&#~,._____ "<<endl;
  350. Sleep(1000);
  351. cout<<"\n\tLa nave ha sido Destruida!! No eres apto para ser maestro jedi\n"<<endl;
  352.                           intentos=0;
  353.                           Beep ( 740 , 200);
  354.                           cout<<"\n\t\tPresione enter para dirigirse al menu\n"<<endl;
  355.                           getch();
  356.                           system("cls");
  357.                 }
  358.                 break;
  359.  
  360.                
  361.            
  362.            
  363.             case 2:  
  364.             system("cls");
  365.             cout<<"\t\tCon que te crees un Maestro Jedi??  Te pondre a prueba!"<<endl;
  366.             Sleep (3000);
  367.             system("cls");
  368.             Beep ( 659 , 200);  
  369.             cout<<"\t\t//////////////////////////////////////////////////"<<endl;
  370.             cout<<"\t\t//                 Picas y Fijas                //"<<endl;
  371.             cout<<"\t\t--------------------------------------------------"<<endl;
  372.             cout<<"\t\t// La mision es encontrar el Numero de 4 Cifras //"<<endl;
  373.             cout<<"\t\t--------------------------------------------------"<<endl;
  374.             cout<<"\t\t//  Solo tienes 10 Intentos , Nuestro futuro... //"<<endl;
  375.             cout<<"\t\t//    Esta en tus Manos... Confiamos en TI!     //"<<endl;
  376.             cout<<"\t\t--------------------------------------------------"<<endl;
  377.            
  378.            do{
  379.                
  380.                 status2=0;
  381.                 n=1000;
  382.                
  383.                 r1 = 1000;
  384.                 r2 = 9999 + 1;
  385.                 numero = r1+rand()%(r2 - r1);
  386.                 cout<<"\t\t || Numero aleatorio generado > "<<numero<<endl;
  387.                
  388.                    for (contador1=0;contador1<4;contador1++)
  389.                    {
  390.                        nivel2[contador1] = numero/n;
  391.                        residuo = numero%n;    
  392.                        numero = residuo;
  393.                        n = n/10;
  394.                    }
  395.                
  396.                    agax=nivel2[0];  
  397.                    agax1=nivel2[1];
  398.                    agax2=nivel2[2];
  399.                    agax3=nivel2[3];
  400.                    
  401.                
  402.                    for (contador1=0;contador1<=3;contador1++)
  403.                    {
  404.                        if(contador1>=1)
  405.                        {
  406.                                 if(agax==nivel2[contador1])
  407.                                 {                
  408.                                                 status2=1;
  409.                                 }
  410.                        }
  411.                        if(contador1>=2)
  412.                        {
  413.                                 if(agax1==nivel2[contador1])
  414.                                 {
  415.                                                 status2=1;
  416.                                 }
  417.                        }
  418.                        if(contador1>=3)
  419.                        {
  420.                                 if(agax2==nivel2[contador1])
  421.                                 {
  422.                                                 status2=1;
  423.                                 }
  424.                        }
  425.                    }
  426.                 }while(status2==1);
  427.                
  428.  
  429.                
  430.                 do{
  431.                    fijas=0;
  432.                    picas=0;
  433.                    n=1000;
  434.                    status2=0;
  435.                    
  436.                    cout<<"\t\t ||Digite un numero de 4 cifras > ";
  437.                    cin>>num_user;
  438.  
  439.                    for (contador1=0;contador1<4;contador1++)
  440.                    {
  441.                        iu2[contador1] = num_user/n;
  442.                        residuo = num_user%n;  
  443.                        num_user = residuo;
  444.                        n = n/10;
  445.                    
  446.                    }
  447.                    
  448.                    auserx=iu2[0];  
  449.                    auserx1=iu2[1];
  450.                    auserx2=iu2[2];
  451.                    auserx3=iu2[3];
  452.                    
  453.                    
  454.                    for (contador1=0;contador1<=3;contador1++)
  455.                    {
  456.                        if(contador1>=1)
  457.                        {
  458.                                 if(auserx==iu2[contador1])
  459.                                 {
  460.                                                 status2=1;
  461.                                 }
  462.                        }
  463.                        if(contador1>=2)
  464.                        {
  465.                                 if(auserx1==iu2[contador1])
  466.                                 {
  467.                                                 status2=1;
  468.                                 }
  469.                        }
  470.                         if(contador1>=3)
  471.                         {
  472.                                 if(auserx2==iu2[contador1])
  473.                                 {
  474.                                                 status2=1;
  475.                                 }
  476.                         }
  477.                    }
  478.                    
  479.                    if(status2==1)
  480.                    {
  481.                         cout<<"\t\t Alerta!! has Tecleado el mismo numero mas de una vez!!"<<endl;
  482.                    }else
  483.                    {
  484.                         for (contador1=0;contador1<=3;contador1++)
  485.                         {
  486.                             for(contador2=0;contador2<=3;contador2++)
  487.                             {
  488.                                          
  489.                                 if(iu2[contador2]==nivel2[contador1])
  490.                                 {
  491.                                    
  492.                                     if(contador2==contador1)
  493.                                     {
  494.                                              fijas++;        
  495.                                     }else
  496.                                     {
  497.                                              picas++;
  498.                                     }
  499.                                 }              
  500.                             }  
  501.                         }
  502.    
  503.                         intentos++;
  504.                         cout<<"\t\t-------------------------------------------------"<<endl;
  505.                         cout<<"\t\t llevas "<<intentos<<" Intentos."<<endl;
  506.                         cout<<"\t\t Tienes "<<fijas<<" Fijas > y " <<picas<<" Picas. "<<fijas<<endl;
  507.                    
  508.                    }
  509.                    if(fijas==4)
  510.                    {
  511.                              status2=0;
  512.                    }else
  513.                    {
  514.                              status2=1;
  515.                    }
  516.                    if(intentos==10)
  517.                    {
  518.                              status2=0;
  519.                    }
  520.                 }while(status2!=0);
  521.                
  522.                                 if(fijas==4){
  523.                           system("cls");
  524.                           Sleep(1000);                      
  525. cout<<"                                 .                            .                      ."<<endl;
  526. cout<<"                     .           ------=========---      .            ."<<endl;
  527. cout<<"                           -)----====    ,'   ,'   .                 ."<<endl;
  528. cout<<"              .                  `.  `.,;___,'                ."<<endl;
  529. cout<<"                                   |||||||||||| "<<endl;
  530. cout<<"                    _,.....------c==]""______ |,,,,,,.....____ _"<<endl;
  531. cout<<"    .      .       ____--------------------------------____-----"<<endl;
  532. cout<<"                                  ,'"",'.   `."<<endl;
  533. cout<<"         .                 -)-----====   `.   `.              LS"<<endl;
  534. cout<<"                     .           ------=========---      .            ."<<endl;
  535. cout<<"             .                               ."<<endl;
  536. Beep ( 740 , 200);
  537. Beep ( 740 , 200);
  538. Beep ( 740 , 200);
  539. Beep ( 740 , 200);
  540. Sleep(1000);
  541. system("cls");
  542. cout<<"         _____"<<endl;
  543. cout<<"       .'/L|__`."<<endl;
  544. cout<<"      | =[_]O|` |"<<endl;
  545. cout<<"      | +-------:|"<<endl;
  546. cout<<"    __:='|____`-:__        Felicitaciones la nave llego a Salvo!!"<<endl;
  547. cout<<"   ||[] ||====| []||"<<endl;
  548. cout<<"   ||[] | |=| | []||       Eres el honorable merecedor de ser un maestro jedi!!"<<endl;
  549. cout<<"   |:||_|=|U| |_||:|"<<endl;
  550. cout<<"   |:|||]_=_ =[_||:| "<<endl;
  551. cout<<"   | |||] [_][]C|| |"<<endl;
  552. cout<<"   ----------------- "<<endl;
  553. cout<<"   ||||||||||||||||| "<<endl;
  554. cout<<"  |___|   |||   |___|   "<<endl;
  555. cout<<"  `---'  |___|  `---'     "<<endl;
  556. cout<<"         `---'  "<<endl;
  557.                          
  558.                          
  559.                           intentos=0;
  560.                           Beep ( 740 , 200);
  561.                           cout<<"\n\t\tPresione enter para dirigirse al menu\n"<<endl;
  562.                           getch();
  563.                           system("cls");
  564.                 }
  565.                 if(intentos==10){
  566.                                 system("cls");
  567.                                
  568. Sleep(1000);
  569. cout<<"                                 .                            .                      ."<<endl;
  570. cout<<"                     .           ------=========---      .            ."<<endl;
  571. cout<<"                           -)----====    ,'   ,'   .                 ."<<endl;
  572. cout<<"              .                  `.  `.,;___,'                ."<<endl;
  573. cout<<"                                   |||||||||||| "<<endl;
  574. cout<<"                    _,.....------c==]""______ |,,,,,,.....____ _"<<endl;
  575. cout<<"    .      .       ____--------------------------------____-----"<<endl;
  576. cout<<"                                  ,'"",'.   `."<<endl;
  577. cout<<"         .                 -)-----====   `.   `.              LS"<<endl;
  578. cout<<"                     .           ------=========---      .            ."<<endl;
  579. cout<<"             .                               ."<<endl;
  580. Beep ( 740 , 200);
  581. Beep ( 740 , 200);
  582. Beep ( 740 , 200);
  583. Beep ( 740 , 200);
  584. Sleep(1000);
  585. system("cls");
  586. cout<<"\t\t\t      _.-^^---....,,--"<<endl;
  587. cout<<"\t\t\t  _--                  --_"<<endl;
  588. cout<<"\t\t\t  <                        >)"<<endl;
  589. cout<<"\t\t\t  |                         |"<<endl;
  590. cout<<"\t\t\t    ._                   _./"<<endl;
  591. cout<<"\t\t\t      ```--. . , ; .--'''"<<endl;
  592. cout<<"\t\t\t            | |   |"<<endl;
  593. cout<<"\t\t\t         .-=||  | |=-."<<endl;
  594. cout<<"\t\t\t         `-=#$%&%$#=-'"<<endl;
  595. cout<<"\t\t\t            | ;  :|"<<endl;
  596. cout<<"\t\t\t   _____.,-#%&$@%#&#~,._____ "<<endl;
  597. Sleep(1000);
  598. cout<<"\n\tLa nave ha sido Destruida!! No eres apto para ser maestro jedi\n"<<endl;
  599.                           intentos=0;
  600.                           Beep ( 740 , 200);
  601.                           cout<<"\n\t\tPresione enter para dirigirse al menu\n"<<endl;
  602.                           getch();
  603.                           system("cls");
  604.                 }
  605.                 break;
  606.                
  607.             case 3:  
  608.             system("cls");
  609.             cout<<"\t\tSolo las almas oscuras seran capaces att: Darth vader"<<endl;
  610.             Sleep (3000);
  611.             system("cls");
  612.             Beep ( 659 , 200);
  613. cout<<"              ________   ___   ____"<<endl;
  614. cout<<"             / __   __| | _ | |  _ | "<<endl;
  615. cout<<"       ______> | | |   |  _  ||    /_______________________________"<<endl;
  616. cout<<"      / _______/ |_|   |_| |_||_||______________________________ __| "<<endl;
  617. cout<<"     / /                                                         | | "<<endl;
  618. cout<<"    | |      La capacidad de destruir un planeta                 | |"<<endl;
  619. cout<<"    | |    es insignificante, comparada al poder de la fuerza    | |"<<endl;
  620. cout<<"    | |                                                          | |"<<endl;
  621. cout<<"    | |            Objetivos                                     | |"<<endl;
  622. cout<<"    | |               * Descifrar la clave de Obi-wan            | |"<<endl;
  623. cout<<"    | |               * hacerlo en 13 Intentos                   | |"<<endl;
  624. cout<<"    | |                                                          | |"<<endl;
  625. cout<<"    | |               Son 6 Digitos   y tenemos poco tiempo.     | |"<<endl;
  626. cout<<"    | |                                                          | |"<<endl;
  627. cout<<"    |_|__________________________________________________________|_|"<<endl;
  628. cout<<"      |___________________________________________________________/"<<endl;
  629.  
  630.  
  631.  
  632.            
  633.             do{
  634.                
  635.                 status2=0;
  636.                 n=100000;
  637.                
  638.                 r1 = 100000;
  639.                 r2 = 999999 + 1;
  640.                 numero = r1+rand()%(r2 - r1);
  641.                 cout<<"\t\t || Numero aleatorio generado > "<<numero<<endl;
  642.                
  643.                    for (contador1=0;contador1<6;contador1++)
  644.                    {
  645.                        nivel3[contador1] = numero/n;
  646.                        residuo = numero%n;  
  647.                        numero = residuo;
  648.                        n = n/10;
  649.                    }
  650.                
  651.                    agax=nivel3[0];  
  652.                    agax1=nivel3[1];
  653.                    agax2=nivel3[2];
  654.                    agax3=nivel3[3];
  655.                    agax4=nivel3[4];
  656.                    agax5=nivel3[5];
  657.                    
  658.                
  659.                    for (contador1=0;contador1<=5;contador1++)
  660.                    {
  661.                        if(contador1>=1)
  662.                        {
  663.                                 if(agax==nivel3[contador1])
  664.                                 {
  665.                                                 status2=1;
  666.                                 }
  667.                        }
  668.                        if(contador1>=2)
  669.                        {
  670.                                 if(agax1==nivel3[contador1])
  671.                                 {
  672.                                                 status2=1;
  673.                                 }
  674.                        }
  675.                        if(contador1>=3)
  676.                        {
  677.                                 if(agax2==nivel3[contador1])
  678.                                 {
  679.                                                 status2=1;
  680.                                 }
  681.                        }
  682.                        if(contador1>=4)
  683.                        {
  684.                                 if(agax3==nivel3[contador1])
  685.                                 {
  686.                                                 status2=1;
  687.                                 }
  688.                        }
  689.                        if(contador1>=5)
  690.                        {
  691.                                 if(agax4==nivel3[contador1])
  692.                                 {
  693.                                                 status2=1;
  694.                                 }
  695.                        }
  696.                        
  697.                    }
  698.                 }while(status2==1);
  699.                
  700.                
  701.                
  702.                 do{
  703.                    fijas=0;
  704.                    picas=0;
  705.                    n=100000;
  706.                    status2=0;
  707.                    
  708.                  
  709.                    cout<<"\t\t ||Digite un numero de 6 cifras > ";
  710.                    cin>>num_user;
  711.                    
  712.                    
  713.                    for (contador1=0;contador1<6;contador1++)
  714.                    {
  715.                        iu3[contador1] = num_user/n;
  716.                        residuo = num_user%n;    
  717.                        num_user = residuo;
  718.                        n = n/10;
  719.                    
  720.                    }
  721.                    
  722.                    auserx=iu3[0];  
  723.                    auserx1=iu3[1];
  724.                    auserx2=iu3[2];
  725.                    auserx3=iu3[3];
  726.                    auserx4=iu3[4];
  727.                    auserx5=iu3[5];
  728.                    
  729.                
  730.                    for (contador1=0;contador1<=5;contador1++)
  731.                    {
  732.                        if(contador1>=1)
  733.                        {
  734.                                 if(auserx==iu3[contador1])
  735.                                 {
  736.                                                 status2=1;
  737.                                 }
  738.                        }
  739.                        if(contador1>=2)
  740.                        {
  741.                                 if(auserx1==iu3[contador1])
  742.                                 {
  743.                                                 status2=1;
  744.                                 }
  745.                        }
  746.                         if(contador1>=3)
  747.                         {
  748.                                 if(auserx2==iu3[contador1])
  749.                                 {
  750.                                                 status2=1;
  751.                                 }
  752.                         }
  753.                         if(contador1>=4)
  754.                         {
  755.                                 if(auserx3==iu3[contador1])
  756.                                 {
  757.                                                 status2=1;
  758.                                 }
  759.                         }
  760.                         if(contador1>=5)
  761.                         {
  762.                                 if(auserx4==iu3[contador1])
  763.                                 {
  764.                                                 status2=1;
  765.                                 }
  766.                         }
  767.                    }
  768.                    
  769.                    if(status2==1)
  770.                    {
  771.                         cout<<"\t\t Alerta!! has Tecleado el mismo numero mas de una vez!!"<<endl;
  772.                    }else{
  773.                         for (contador1=0;contador1<6;contador1++)
  774.                         {
  775.                             for(contador2=0;contador2<6;contador2++)
  776.                             {
  777.                                          
  778.                                 if(iu3[contador2]==nivel3[contador1])
  779.                                 {
  780.                                    
  781.                                     if(contador2==contador1)
  782.                                     {
  783.                                              fijas++;        
  784.                                     }else
  785.                                     {
  786.                                              picas++;
  787.                                     }
  788.                                 }              
  789.                             }  
  790.                         }
  791.    
  792.                         intentos++;
  793.                         cout<<"\t\t-------------------------------------------------"<<endl;
  794.                         cout<<"\t\t llevas "<<intentos<<" Intentos."<<endl;
  795.                         cout<<"\t\t Tienes "<<fijas<<" Fijas > y " <<picas<<" Picas. "<<fijas<<endl;
  796.                    
  797.                    }
  798.                    if(fijas==6)
  799.                    {
  800.                              status2=0;
  801.                    }else{
  802.                              status2=1;
  803.                    }
  804.                    if(intentos==13)
  805.                    {
  806.                              status2=0;
  807.                    }
  808.                 }while(status2!=0);
  809.                
  810.              
  811.                 if(fijas==6)
  812.                 {
  813. system("cls");
  814.                           Sleep(1000);                           
  815. cout<<"\t   _________________________________ "<<endl;
  816. cout<<"\t  |:::::::::::::;;::::::::::::::::::| "<<endl;
  817. cout<<"\t  |:::::::::::'~||~~~``:::::::::::::| "<<endl;
  818. cout<<"\t  |::::::::'   .':     o`:::::::::::| "<<endl;
  819. cout<<"\t  |:::::::' oo | |o  o    ::::::::::| "<<endl;
  820. cout<<"\t  |::::::: 8  .'.'    8 o  :::::::::| "<<endl;
  821. cout<<"\t  |::::::: 8  | |     8    :::::::::| "<<endl;
  822. cout<<"\t  |::::::: _._| |_,...8    :::::::::| Ya Perteneces al lado oscuro."<<endl;
  823. cout<<"\t  |::::::'~--.   .--. `.   `::::::::| "<<endl;
  824. cout<<"\t  |:::::'     =8     ~    o ::::::::| "<<endl;
  825. cout<<"\t  |::::'       8._ 88.     o::::::::| "<<endl;
  826. cout<<"\t  |:::'   __. ,.ooo~~.      o`::::::| "<<endl;
  827. cout<<"\t  |:::   . -. 88`78o/:        `:::::|  Sigue mis instrucciones o      "<<endl;
  828. cout<<"\t  |::'     /. o o   ::       88`::::|           tendre que destruirte"<<endl;
  829. cout<<"\t  |:;     o|| 8 8 |d.        `8 `:::| "<<endl;
  830. cout<<"\t  |:.       - ^ ^ -'           `-`::| "<<endl;
  831. cout<<"\t  |::.                          .:::| "<<endl;
  832. cout<<"\t  |:::::.....           ::'     ``::| "<<endl;
  833. cout<<"\t  |::::::::-'`-        88          `| "<<endl;
  834. cout<<"\t  |:::::-'.          -       ::     | "<<endl;
  835. cout<<"\t  |:-~. . .                   :     | "<<endl;
  836. cout<<"\t  |_________________________________|"<<endl;
  837. cout<<"\n\t\tPresione enter para dirigirse al menu\n"<<endl;
  838.                           getch();
  839.                           system("cls");
  840.                           intentos=0;
  841.                 }
  842.                 if(intentos==13)
  843.                 {
  844. system("cls");
  845.                           Sleep(1000);                           
  846.  
  847. cout<<"\t        ____________ __________________ ___________"<<endl;
  848. cout<<"\t       |           FRACASADOOOOOOOOOOOOOO         |"<<endl;
  849. cout<<"\t       | -""  Moriras por hacerme perder el tiempo|"<<endl;
  850. cout<<"\t      .-|  . )     (                              |"<<endl;
  851. cout<<"\t     j   .'_+     :[                )      .^--.. |"<<endl;
  852. cout<<"\t    i    -""       |l                ].    /       i|"<<endl;
  853. cout<<"\t   ,"".:j         ||o  _,,+.,.--,   d|    :::;    b"<<endl;
  854. cout<<"\t   i  :'|          ""--p;.  (-._"".oP        .   :" <<endl;
  855. cout<<"\t   ; .  (            >,%%%   f),):8""          :'  i" <<endl;
  856. cout<<"\t  i  :: j          ,;%%%:; ; ; i:%%%.,        i.   `."<<endl;
  857. cout<<"\t  i  `: ( ____  ,-::::::' ::j  [:```          [8:   )"<<endl;
  858. cout<<"\t  <  ..``'::::8888oooooo.  :(jj(,;,,,         [8::  <"<<endl;
  859. cout<<"\t  `. ``:.      oo.8888888888:;%%%8o.::.+888+o.:`:'  |"<<endl;
  860. cout<<"\t   `.   `        `o`88888888b`%%%%%88< Y888P""'-    ;"<<endl;
  861. cout<<"\t      --- .       Y888888888., 88b..::::        _   :  "<<endl;
  862. cout<<"\t       |    ""....  b`8888888:::::.`8888._::-""   |"<<endl;
  863. cout<<"\t       |       `:::. `:::::O:::::::.`%%'|         |"<<endl;
  864. cout<<"\t       |        `.      ""``::::::''    .'        |"<<endl;
  865. cout<<"\t       |          `.                   <          |"<<endl;
  866. cout<<"\t       |            +:         `:   -';           |"<<endl;
  867. cout<<"\t       |  ____       `:         : .::/            |"<<endl;
  868. cout<<"\t       | `-|--        ;+_  :::. :..;;;         LS |"<<endl;
  869. cout<<"\t       |______________;;;;,;;;;;;;;,;;____________|"<<endl;
  870. cout<<"\n\t\tPresione enter para dirigirse al menu\n"<<endl;
  871.                           getch();
  872.                           system("cls");
  873.                           intentos=0;
  874.                 }
  875.                 break;
  876.                
  877.             case 4:   system("cls");
  878.                       break;  
  879.             default: system("cls"); Beep( 790, 300 ); cout<<"\t\tNo Intentes nada RARO Te devolvere al menu principal!"; Sleep(3000);  
  880.                      system("cls");    
  881.                      
  882.            }
  883.      break;
  884.            
  885.      //opcionx2 [INSTRUCCIONES]
  886.      case 2:
  887.           system("cls");
  888.           int subop2;  
  889.      cout<<"\t/////////////////////////////////////////////////////////////"<<endl;    
  890.      cout<<"\t//                      INSTRUCCIONES                      //"<<endl;              
  891.      cout<<"\t---------------------------------------------------------- //"<<endl;
  892.      cout<<"\t---------------------------------------------------------- //"<<endl;
  893.      cout<<"\t// El sistema calculara una cadena de numeros de [3,4 o 6] //"<<endl;
  894.      cout<<"\t// Cifras, a su vez, los jugadores tratan de adivinar      //"<<endl;
  895.      cout<<"\t// el nĂºmero de su oponente [Maquina].Si las cifras son    //"<<endl;
  896.      cout<<"\t// coincidentes en sus posiciones correctas, son *Fijas*,  //"<<endl;
  897.      cout<<"\t// Si, en diferentes posiciones, son *Picas*.              //"<<endl;
  898.      cout<<"\t//                                                         //"<<endl;
  899.      cout<<"\t// Ejemplo:   El numero secreto: 4271                      //"<<endl;
  900.      cout<<"\t//            Intento del oponente: 1234                   //"<<endl;
  901.      cout<<"\t//                                                         //"<<endl;
  902.      cout<<"\t// Respuesta: (La fija es '2', las picas son '4' y '1'.)   //"<<endl;
  903.      cout<<"\t---------------------------------------------------------- //"<<endl;
  904.      cout<<"\t---------------------------------------------------------- //"<<endl;
  905.      cout<<"\t/////////////////////////////////////////////////////////////\n"<<endl;
  906.      cout<<"\t      Presione la tecla '1' para volver al menu: ";
  907.      cin>>subop2;  
  908.         //SUBopcionxES
  909.           switch (subop2)
  910.            {
  911.            case 1:   system("cls"); break;
  912.            default: system("cls"); Beep( 790, 300 ); cout<<"\t\tNo Intentes nada RARO Te devolvere al menu principal!"; Sleep(3000);  
  913.                      system("cls");  
  914.  
  915.                        
  916.                      
  917.            }
  918.      break;
  919.      
  920.  
  921.      //opcionx3 [CREDITOS - SALIR]
  922.      case 3:
  923.           system("cls");
  924.          
  925.     Beep( 790, 300 ); Sleep(1000);cout<<"\t/////////////////////////////////////////////////////////////"<<endl;    
  926.     Beep( 790, 300 ); Sleep(1000);cout<<"\t//                      Creador                            //"<<endl;              
  927.     Beep( 790, 300 ); Sleep(1000);cout<<"\t---------------------------------------------------------- //"<<endl;
  928.     Beep( 790, 300 );  Sleep(1000);cout<<"\t---------------------------------------------------------- //"<<endl;
  929.     Beep( 790, 300 ); Sleep(1000);cout<<"\t//                      MaztoR [IN]-Security               //"<<endl;
  930.     Beep( 790, 300 ); Sleep(1000);cout<<"\t//              [Maztor.Blogspot.com]                      //"<<endl;
  931.     Beep( 790, 300 ); Sleep(1000);cout<<"\t//---------------------------------------------------------//"<<endl;
  932.     Beep( 790, 300 ); Sleep(1000);cout<<"\t/////////////////////////////////////////////////////////////\n\n"<<endl;
  933.  
  934.  
  935.  
  936.  
  937.     Beep( 800, 800 ); status=1;
  938.      
  939.      break;
  940.  
  941.                        
  942.      default: system("cls"); Beep( 790, 300 ); cout<<"\t\tNo Sabes leer??? No existe esta opcionx -.-!"; Sleep(3000);  
  943.                      system("cls");                
  944.  
  945.      
  946.     }
  947.    
  948.  
  949.      }while(status==0);
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.     system("PAUSE");
  957.     return 0;
  958. }