daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. boolean check;
  2. int counter;
  3. int number;
  4. String zin1 ="Guess a number (between 0 and 9)please:";
  5. int xPosBox=20,yPosBox=40,widthBox=100,heightBox=25;
  6. String guess="";
  7. String checkZin="Guess nr"+guess ;
  8. int padding=20;
  9. void setup(){
  10.   size(600,200);
  11.   number=(int)random(0,10);
  12.    println(number);
  13. }
  14. void draw()
  15. {
  16.   background(255);
  17.   textSize(15);
  18.   fill(0);
  19.   text(zin1,20,20);
  20.  
  21.   fill(255);
  22.   stroke(0);
  23.   rect(xPosBox,yPosBox,widthBox,heightBox);
  24.   fill(0);
  25.   textMode(CENTER);
  26.   text(guess,xPosBox+padding,yPosBox+padding);
  27.  
  28.  
  29. if(check=true && number!=guess && guess>number){
  30.   println(checkZin);
  31. }
  32. }
  33.  
  34.  
  35. void keyPressed(){
  36.  
  37.  
  38.   if (key>='0'&& key<='9'){
  39.     guess += key;
  40.     counter++;
  41.   }
  42.   if(key == ENTER && guess.length()==1){
  43.     check = true;
  44.   }
  45.  
  46. }
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