Skip to content

Instantly share code, notes, and snippets.

@nnirror
Created January 9, 2026 15:00
Show Gist options
  • Select an option

  • Save nnirror/e04121d6f079763f577697cbf637ba00 to your computer and use it in GitHub Desktop.

Select an option

Save nnirror/e04121d6f079763f577697cbf637ba00 to your computer and use it in GitHub Desktop.
Facet code: _.loadimage('png_goes_here',1000).dim(1000,1000).scale(0,1).map([0,1/8,2/8,3/8,4/8,5/8,6/8,7/8,1]).saveimg('genuary9/'+ts()).iter(7200,_.run(()=>{for(var a=0;a<this.data.length;a++){let is_first_row,is_last_row,is_left_boundary,is_right_boundary=false;let indices=[];if (a%image_width==0){is_left_boundary=true;}else if(a%image_width==image_width-1){is_right_boundary=true;}if(a<this.image_width){is_first_row=true;if(!is_left_boundary){indices.push(a+(this.image_width+1));indices.push(a-1);}if(!is_right_boundary){indices.push(a+(this.image_width-1));indices.push(a+1);}indices.push(a+this.image_width);}else if(a>=this.image_width*(this.image_height-1)){is_last_row=true;if(!is_left_boundary){indices.push(a-(this.image_width+1));indices.push(a-1);}if(!is_right_boundary){indices.push(a-(this.image_width-1));indices.push(a+1);}indices.push(a-this.image_width);}else{if(!is_left_boundary){indices.push(a-(this.image_width+1));indices.push(a-1);}if(!is_right_boundary) {indices.push(a-(this.image_width-1));indices.push(a+1);}indices.push(a-this.image_width);if(!is_left_boundary){indices.push(a+(this.image_width-1));}if(!is_right_boundary){indices.push(a+(this.image_width+1));}indices.push(a+this.image_width);}let sum=0;for(var b=0;b<indices.length; b++){sum+=this.data[indices[b]];}if(sum>2){for(var b=0;b<indices.length;b++){for(var c=0;c<indices.length;c++){if(b==c){continue;}if(this.data[indices[b]]==this.data[indices[c]]){let tmp_b=this.data[indices[b]];let tmp_b1=this.data[indices[b-1>=0?b-1:0]];this.data[indices[b-1>0?b-1:0]]=tmp_b;this.data[indices[b]]=tmp_b1;let tmp_c = this.data[indices[c]];let tmp_c1=this.data[indices[c+1<indices.length?c+1:indices.length-1]];this.data[indices[c+1<this.image_width-1?c+1:this.image_width-1]]=tmp_c;this.data[indices[c]]=tmp_c1;}}}}}this.saveimg('genuary9/'+ts())})).once();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment