Advertisement
Rupek69

2d binary counter

Nov 24th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. int iter = 0;
  2. int x, y, step =0;
  3. int pix[][] = new int [10][10];
  4. void setup() {
  5.   size(10, 10);
  6.   background(0);
  7.   colorMode(RGB, 2);
  8.   frameRate(500);
  9. };
  10.  
  11. void draw() {
  12.  
  13.   x=0;
  14.   y=0;
  15.  
  16.   if (pix[x][y] > 1) {
  17.     while (pix[x][y]>1) {
  18.       if (y>=9) {
  19.         pix[x][y]=0;
  20.         y=0;
  21.         x++;
  22.       } else if(x<9){
  23.         pix[x][y]=0;
  24.         y++;
  25.       }
  26.       else {
  27.         x=0;
  28.         y=0;
  29.       }
  30.     }
  31.   }
  32.   pix[x][y]++;
  33.   if(step > 3) {
  34.     for (int i= 0; i<width; i++) {
  35.       for (int j = 0; j<height; j++) {
  36.         //  translate(100, 100);
  37.         set(i, j, color(pix[i][j]));
  38.       }
  39.     }
  40.     step=0;
  41.   }
  42.   step++;
  43. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement