Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //kill meeeeeee
- void medianpass() {
- for(int j=0;j<YSIZE;j++){
- for(int i=0;i<XSIZE;i++){
- tmap[i+XSIZE*j]=map[i+XSIZE*j];
- int n[12];
- int c[12];
- int nc=0;
- int t;
- t=map[((i+1)%XSIZE)+XSIZE*j];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[((i+XSIZE-1)%XSIZE)+XSIZE*j];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[i+XSIZE*((j+1)%YSIZE)];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[i+XSIZE*((j+YSIZE-1)%YSIZE)];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[((i+2)%XSIZE)+XSIZE*j];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[((i+XSIZE-2)%XSIZE)+XSIZE*j];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[i+XSIZE*((j+2)%YSIZE)];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[i+XSIZE*((j+YSIZE-2)%YSIZE)];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[((i+1)%XSIZE)+XSIZE*((j+1)%YSIZE)];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[((i+XSIZE-1)%XSIZE)+XSIZE*((j+1)%YSIZE)];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[((i+1)%XSIZE)+XSIZE*((j+YSIZE-1)%YSIZE)];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- t=map[((i+XSIZE-1)%XSIZE)+XSIZE*((j+YSIZE-1)%YSIZE)];
- for(int k=0;k<=nc;k++){if(k==nc){n[nc]=t;c[nc]=1;nc++;break;}if(n[k]==t){c[k]++;break;}}
- int d[13];
- for(int k=0;k<=12;k++)d[k]=0;
- for(int l=0;l<12;l++){
- for(int k=0;k<=12;k++){
- if(c[l]==k)d[k]++;
- }
- }
- for(int l=12;l>0;l--){
- if(d[l]){
- int r=rnd.roll(d[l]);
- int s=0;
- for(int k=0;k<nc;k++){
- if(c[k]==l){
- if(s==r){
- tmap[i+XSIZE*j]=n[k];
- break;
- }else s++;
- }
- }
- break;
- }
- }
- }
- }
- int* tmp=tmap;
- tmap=map;
- map=tmp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement