Advertisement
Guest User

tien bb

a guest
Apr 15th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 6.60 KB | None | 0 0
  1.  
  2. int tab1[]=new int[200];
  3. int tab[]=new int[200];
  4. int play; int turn; int time=1050-(turn*50); int color; int variablesuperlonguequiforcelerespect;int cas1=0;int cas2=0;int c=0; int variablesuperlonguequiforcelerespect2;
  5. boolean jouer=true;int faute=0;
  6. void main(){
  7. initialisation();
  8. bonhomme();
  9. turn=1;
  10. while(jouer=true){
  11. modele();
  12. }
  13. println("FIN");
  14. }
  15. void initialisation(){
  16.     reset(50,50);
  17.     int x=-50; int y=50; turn=0;
  18.     green(); red(); yellow(); blue();
  19.     while(x<51){
  20.         setPixel(x,-20,237,213,0);//démarquation 1
  21.         setPixel(x,-21,255,255,112);//démarquation 2
  22.         setPixel(x,-22,237,213,0);//démarquation 3
  23.         setPixel(x,-23,168,124,1);//démarquation 4
  24.         x++;
  25.     }
  26.     x=-34;
  27.     while(x<35){
  28.         setPixel(x,15,0);//milieu horizontal
  29.         setPixel(x,50,0);//haut
  30.         setPixel(x,-20,0);//bas
  31.         x++;
  32.     }
  33.     while(y>-21){
  34.         setPixel(0,y,0);//milieu vertical
  35.         setPixel(-35,y,0);//borne 1
  36.         setPixel(35,y,0);//borne 2
  37.         y--;
  38.     }
  39.     y=-50;
  40.     while(y<-23){//remplissage menu bas gris
  41.         x=-50;
  42.         while(x<51){
  43.             setPixel(x,y,240);
  44.             x++;
  45.         }
  46.         y++;
  47.     }
  48. }
  49. void bonhomme(){
  50.     int x=-44;
  51.     int y;
  52. while(x<-39){//ligne de 5 milieu
  53.     setPixel(x,-26,255,255,0);//chapeau 2
  54.     setPixel(x,-27,255,0,0);//chapeau rouge
  55.     setPixel(x,-29,255,218,130);//visage 1
  56.     setPixel(x,-30,255,218,130);//visage 2
  57.     setPixel(x,-31,255,218,130);//visage 3
  58.     setPixel(x,-41,0);//ceinture
  59.     y=-33;
  60.     while(y>-41){//corps
  61.         setPixel(x,y,0,1,110);
  62.         y--;
  63.     }
  64.     y=-44;
  65.     while(y>-48){
  66.         setPixel(x,y,74,74,255);
  67.         y--;
  68.     }
  69.     x++;
  70. }
  71.     x=-43;
  72.     while(x<-40){//ligne de 3 milieu
  73.         setPixel(x,-25,255,255,0);//chapeau 1
  74.         setPixel(x,-42,74,74,255);//pant 1
  75.         setPixel(x,-43,74,74,255);//pant 2
  76.         setPixel(x,-33,255,255,0);//scarf 1
  77.         setPixel(x,-34,255,255,0);//scarf 2
  78.         setPixel(x,-30,0);//eye
  79.         setPixel(x,-32,255,218,130);//visage 4
  80.         x++;
  81.     }
  82. x=-45;
  83. while(x<-38){//chapeau et chaussure ligne de 7
  84.     setPixel(x,-28,255,255,0);
  85.     setPixel(x,-48,94,50,0);
  86.     x++;
  87. }
  88. setPixel(-42,-30,255,218,130);//eye
  89. setPixel(-42,-35,255,255,0);//scarf 3
  90. setPixel(-42,-37,255,0,0);//bouton 1
  91. setPixel(-42,-39,255,0,0);//bouton 2
  92. setPixel(-42,-41,255,255,255);
  93. setPixel(-39,-37,94,50,0);//panneau
  94. setPixel(-44,-42,156,205,255);//poche
  95. setPixel(-44,-43,156,205,255);//
  96. setPixel(-40,-42,156,205,255);//
  97. setPixel(-40,-43,156,205,255);//poche
  98. y=-44;
  99. while(y>-49){//entrejambe ligne droite milieu
  100.     setPixel(-42,y,240);
  101.     y--;
  102. }
  103. setPixel(-46,-33,0,1,110);//bras gauche début
  104. setPixel(-45,-33,0,1,110);//
  105. setPixel(-45,-34,0,1,110);//bras gauche début
  106. x=-47;
  107. while(x<-45){//bras gauche
  108.     y=-34;
  109.     while(y>-39){
  110.         setPixel(x,y,0,1,110);
  111.         y--;
  112.     }
  113.     x++;
  114. }
  115. setPixel(-46,-39,255,218,130);//main gauche
  116. setPixel(-47,-39,255,218,130);//
  117. setPixel(-46,-40,255,218,130);//
  118. setPixel(-47,-40,255,218,130);//main gauche
  119. y=-37;
  120. while(y>-40){
  121.     setPixel(-38,y,0,1,110);
  122.     setPixel(-37,y,0,1,110);
  123.     y--;
  124. }
  125. x=-40;
  126. while(x<-37){//main droite
  127.     y=-38;
  128.     while(y>-41){
  129.         setPixel(x,y,255,218,130);
  130.         y--;
  131.     }
  132.     x++;
  133. }
  134. x=-41;
  135. while(x<-36){
  136.     y=-32;
  137.     while(y>-37){
  138.         setPixel(x,y,255);//COULEUR PANNEAU
  139.         y--;
  140.     }
  141.     x++;
  142. }
  143.     }
  144. void green(){//remplissage classique vert
  145.     int z=-22; int x2=-12;int y=28; int y2=38; int x;
  146.     if(turn==0){
  147.         z=-34;x2=0;y=16;y2=50;
  148.     }
  149.     while(y<y2){
  150.         x=z;
  151.         while(x<x2){
  152.             setPixel(x,y,150,255,150);
  153.             x++;
  154.         }
  155.         y++;
  156.     }
  157. }
  158. void red(){//remplissage classique rouge
  159.     int z=13; int x2=23;int y=28;int y2=38; int x;
  160.     if(turn==0){
  161.         z=1;x2=35;y=16;y2=50;
  162.     }
  163.     while(y<y2){
  164.         x=z;
  165.         while(x<x2){
  166.             setPixel(x,y,255,150,150);
  167.             x++;
  168.         }
  169.         y++;
  170.     }
  171. }
  172. void yellow(){//remplissage classique jaune
  173.     int x; int z=-22; int x2=-12; int y=-7; int y2=3;
  174.     if(turn==0){
  175.         z=-34;x2=0;y=-19;y2=15;
  176.     }
  177.     while(y<y2){
  178.         x=z;
  179.         while(x<x2){
  180.             setPixel(x,y,255,255,150);
  181.             x++;
  182.         }
  183.         y++;
  184.     }
  185. }
  186. void blue(){//remplissage classique bleu
  187.     int x; int z=13; int x2=23; int y=-7; int y2=3;
  188.     if(turn==0){
  189.         z=1;x2=35;y=-19;y2=15;
  190.     }
  191.     while(y<y2){
  192.         x=z;
  193.         while(x<x2){
  194.             setPixel(x,y,150,150,255);
  195.             x++;
  196.         }
  197.         y++;
  198.     }
  199. }
  200. void light(){
  201.     int x; int y; int z; int x2; int y2; int R; int V; int B;
  202.     if(color==0){//greenlight
  203.         z=-22; y=28; R=0; V=255; B=0;
  204.     }
  205.     else if(color==1){//redlight
  206.         z=13; y=28; R=255; V=0; B=0;
  207.     }
  208.     else if(color==2){//yellowlight
  209.         z=-22; y=-7; R=255; V=255; B=0;
  210.     }
  211.     else{//bluelight
  212.         z=13; y=-7; R=0; V=0; B=255;
  213.     }
  214.     x2=z+10; y2=y+10;
  215.     while(y<y2){
  216.         x=z;
  217.         while(x<x2){
  218.             setPixel(x,y,R,V,B);
  219.             x++;
  220.         }
  221.         y++;
  222.     }
  223.     sleep(time);
  224.     if(color==0){
  225.         green();
  226.     }
  227.     else if(color==1){
  228.         red();
  229.     }
  230.     else if(color==2){
  231.         yellow();
  232.     }
  233.     else{
  234.         blue();
  235.     }
  236. }
  237.  
  238. void modele(){
  239.     variablesuperlonguequiforcelerespect=turn+3;
  240.     variablesuperlonguequiforcelerespect2=variablesuperlonguequiforcelerespect;
  241.     while(variablesuperlonguequiforcelerespect>0){
  242.         color=random(0,4);
  243.         tab[cas1]=color+1;
  244.         cas1++;
  245.         light();
  246.         variablesuperlonguequiforcelerespect--;
  247.     }
  248.     while(variablesuperlonguequiforcelerespect2>0){
  249.         while(c==0){
  250.         setRunnable(new Runnable() { public void run() {
  251.             int a=getX();
  252.             int z=getY();  
  253.             if (((-1)>a && a>(-34))&&(16<z && z<46)){
  254.                 c=1;
  255.                 println("vert");
  256.             }
  257.             else if ((1<a && a<34)&&(16<z && z<46)){
  258.                 c=2;
  259.                 println("rouge");
  260.             }
  261.             else if (((-1)>a && a>(-34))&&(14>z && z>(-19))){
  262.                 c=3;
  263.                 println("Jaune");
  264.             }
  265.             else if ((1<a && a<34)&&(14>z && z>(-19))){
  266.                 c=4;
  267.                 println("Bleu");
  268.             }
  269.             else{
  270.                 c=0;
  271.             println("Clickez sur les cases et évitez les bordures svp.");
  272.             }
  273.         }});
  274.     }
  275.           tab1[cas2]=c;
  276.           if (tab1[cas2]!=tab[cas2]){
  277.             faute++;
  278.             println("réessaie bb");
  279.                 if (faute==3){
  280.                     jouer=false;
  281.            
  282.           }
  283.         else{
  284.         cas2++;
  285.         variablesuperlonguequiforcelerespect2--;
  286.         println("bon");
  287.         }
  288.     }
  289. }
  290. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement