<commit_before>class BubbleSort{
  ArrayAnim arr;
  int currJ;
  boolean sorted;
  int sortLength;
  Code src;
  BubbleSort(int sz){
    arr=new ArrayAnim(sz);
    arr.splitterOn("unsorted","sorted",#FF0000,#00FF00,sz);
    arr.barsOn();
    arr.fillRandom();
    arr.addIndicator(0);
    arr.addIndicator(1);
    arr.setPos(60,100);
    currJ=0;
    sorted=false;
    sortLength=sz- 1;
    src=new Code(20);
    setCode();
  }
  void setCode(){
    src.append("void BubbleSort(int array[],int sz){");
    src.append("  int i;");
    src.append("  int j;");
    src.append("  for (i=0; i<sz; i++) {");
    src.append("    for (j=0; j<size-1-i; j++){:");
    src.append("      if (array[j+1] < array[j]) {");
    src.append("        swap(array[j],array[j+1]);"); 
    src.append("       }");
    src.append("    }");
    src.append("  }");
    src.append("}");
    src.setHighLighter(5);
    src.setPos(550,100);
  }
  void draw(){
    if(!sorted){
      if(arr.state==arr.STABLE){
        if(arr.atIdx(currJ)>arr.atIdx(currJ+1)){
          src.setHighLighter(7);
          arr.setLetterColour(currJ,#ff0000);
          arr.setLetterColour(currJ+1,#ff0000);
          arr.swap(currJ,currJ+1);
        }
        if(arr.state==arr.STABLE){
          src.setHighLighter(6);
          arr.setLetterColour(currJ+1,#000000);
          arr.setLetterColour(currJ,#000000);
          currJ++;
        
          arr.changeIndicator(0,currJ);
          arr.changeIndicator(1,currJ+1);
          if(currJ >= sortLength){
            src.setHighLighter(4);
            currJ=0;
            arr.changeIndicator(0,currJ);
            arr.changeIndicator(1,currJ+1);
            sortLength--;
            if(sortLength==0)
              sorted=true;
          }
          arr.setSplitterPosition(sortLength+1);
        }
      }
    }
    else{
      arr.setSplitterPosition(0);
    }
    arr.draw();
    src.draw();
  }
}

BubbleSort bubble;
int count;
ArrayAnim arr;
//PFont fontA = loadFont("Courier");
void setup(){
 size(900,500);
 background(33,66,99);
 bubble=new BubbleSort(15);
 frameRate(1);
}
void draw(){
   background(46,129,215);
   bubble.draw();   
}<commit_msg>fixed more background related code<commit_after>class BubbleSort{
  ArrayAnim arr;
  int currJ;
  boolean sorted;
  int sortLength;
  Code src;
  BubbleSort(int sz){
    arr=new ArrayAnim(sz);
    arr.splitterOn("unsorted","sorted",#FF0000,#00FF00,sz);
    arr.barsOn();
    arr.fillRandom();
    arr.addIndicator(0);
    arr.addIndicator(1);
    arr.setPos(60,100);
    currJ=0;
    sorted=false;
    sortLength=sz- 1;
    src=new Code(20);
    setCode();
  }
  void setCode(){
    src.append("void BubbleSort(int array[],int sz){");
    src.append("  int i;");
    src.append("  int j;");
    src.append("  for (i=0; i<sz; i++) {");
    src.append("    for (j=0; j<size-1-i; j++){:");
    src.append("      if (array[j+1] < array[j]) {");
    src.append("        swap(array[j],array[j+1]);"); 
    src.append("       }");
    src.append("    }");
    src.append("  }");
    src.append("}");
    src.setHighLighter(5);
    src.setPos(550,100);
  }
  void draw(){
    if(!sorted){
      if(arr.state==arr.STABLE){
        if(arr.atIdx(currJ)>arr.atIdx(currJ+1)){
          src.setHighLighter(7);
          arr.setLetterColour(currJ,#ff0000);
          arr.setLetterColour(currJ+1,#ff0000);
          arr.swap(currJ,currJ+1);
        }
        if(arr.state==arr.STABLE){
          src.setHighLighter(6);
          arr.setLetterColour(currJ+1,#000000);
          arr.setLetterColour(currJ,#000000);
          currJ++;
        
          arr.changeIndicator(0,currJ);
          arr.changeIndicator(1,currJ+1);
          if(currJ >= sortLength){
            src.setHighLighter(4);
            currJ=0;
            arr.changeIndicator(0,currJ);
            arr.changeIndicator(1,currJ+1);
            sortLength--;
            if(sortLength==0)
              sorted=true;
          }
          arr.setSplitterPosition(sortLength+1);
        }
      }
    }
    else{
      arr.setSplitterPosition(0);
    }
    arr.draw();
    src.draw();
  }
}

BubbleSort bubble;
int count;
ArrayAnim arr;
//PFont fontA = loadFont("Courier");
void setup(){
 size(900,500);
 background(46,129,215);
 bubble=new BubbleSort(15);
 frameRate(1);
}
void draw(){
   background(46,129,215);
   bubble.draw();   
}
{'fraction_non_alphanumeric': 0.17621348056130665, 'fraction_numerical': 0.042328042328042326, 'mean_word_length': 2.3575289575289577, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5067609', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1583, 'n_words': 230}