Mastermind (logic game) logic system

Hi!
I created the logic behind game MASTERMIND If you want, just put it into an interface and make it yourself! I hope my lack of organized code is not too bad. I am currently creating the interface myself and when I’m done I’ll post it!

//mastermind
int code[] = {3,8,6,1};
int attempt[] = {3,8,6,1};
int ccNum = 0, cNum = 0;

void setup() {
  size(600,600);
}

void draw() {
  background(0);
  check();
  for(int i = 0; i < code.length; i++) {
    if(ccNum > i) {
      fill(255,0,0);
    } else if (ccNum + cNum > i) {
      fill(255);
    } else {
      fill(0);
    }
    ellipse((i+1)*20,20,5,5);
  }
}

void check() {
  ccNum = 0;
  cNum = 0;
  
  boolean cc[] = new boolean[4];
  boolean c[] = new boolean[4];
  for(int i = 0; i < code.length; i++) if(code[i] == attempt[i]) {
    cc[i] = true;
    ccNum++;
  }
  printArray(cc);
  for(int i = 0; i < attempt.length; i++) {
    for(int j = 0; j < code.length; j++) {
      
      if(i != j) {
        if(attempt[i] == code[j] && !cc[j] && !c[j]) {
          c[j] = true;
          cNum++;
        }
      }
      
    }
  }
  printArray(c);
}