0xf4dc91a5…4d2esent to0xa7d8d9ef…d270·#15,393,025·view on Etherscan
class Random{constructor(){this.useA=!1;let sfc32=function(uint128Hex){let a=parseInt(uint128Hex.substr(0,8),16),b=parseInt(uint128Hex.substr(8,8),16),c=parseInt(uint128Hex.substr(16,8),16),d=parseInt(uint128Hex.substr(24,8),16);return function(){a|=0,b|=0,c|=0,d|=0;let t=(a+b|0)+d|0;return d=d+1|0,a=b^b>>>9,b=c+(c<<3)|0,c=c<<21|c>>>11,c=c+t|0,(t>>>0)/4294967296}};this.prngA=new sfc32(tokenData.hash.substr(2,32)),this.prngB=new sfc32(tokenData.hash.substr(34,32));for(let i=0;i<1e6;i+=2)this.prngA(),this.prngB()}RNd(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}RNn(a,b){return a+(b-a)*this.RNd()}RNi(a,b){return Math.floor(this.RNn(a,b+1))}RNb(p){return this.RNd()<p}RNc(list){return list[this.RNi(0,list.length-1)]}}function draw(){if(8==MAPTYPE){for(ilights in frameRate(3),image(NM,xstart,ystart),image(NM2,xstart,ystart),NM2=createGraphics(Q,Q),NM2.colorMode(HSB,1),xlgts)ix=round(xlgts[ilights]),iy=round(ylgts[ilights]),H[ix][iy]>0&&H[ix][iy]<.28*Mxx&&CLgts[ix][iy]/MxxCities>CTTHR&&CLgts[ix][iy]/MxxCities>1.5*CLgts2[ix][iy]/MxxCities2&&(NM2.strokeWeight(CLgts[ix][iy]/MxxCities*1.5*M),NM2.stroke(34/360,1.5*(1-CLgts[ix][iy]/MxxCities+RN.RNn(-.2,.2)),sq(CLgts[ix][iy]/MxxCities)),NM2.point(ix,iy)),!(H[ix][iy]>0&&H[ix][iy]<.28*Mxx&&CLgts[ix][iy]/MxxCities>CTTHR&&CLgts[ix][iy]/MxxCities>1.5*CLgts2[ix][iy]/MxxCities2)&&(NM2.strokeWeight(CLgts[ix][iy]/MxxCities*CTTHR4*M),NM2.stroke(34/360,.2,1*CLgts[ix][iy]/MxxCities+RN.RNn(-.2,.2)),H[ix][iy]>0&&H[ix][iy]<CTTHR3*Mxx&&NM2.point(ix,iy));for(ilights2 in xlgts2)ix=round(xlgts2[ilights2]),iy=round(ylgts2[ilights2]),H[ix][iy]>CTTHR3&&(NM2.strokeWeight(CLgts[ix][iy]/MxxCities*CTTHR4*M),NM2.stroke(34/360,.2,1*CLgts[ix][iy]/MxxCities+RN.RNn(-.2,.2)),NM2.point(ix,iy))}else 5==MAPTYPE?(GenShadowMap(),image(GeoMap,xstart,ystart),image(Borderimage,xstart,ystart),1!=Ncount&&image(SBI4,xstart+1,ystart+1),image(Regions,xstart,ystart),image(Shadow,xstart,ystart,Q,Q),image(MapBorder,0,0),Tme+=.001):noLoop()}function basicMapDetail(){if(basicMap=createGraphics(Q,Q),basicMap.colorMode(HSB,1),FindMinMaxMeanCentre(H),dQ=(Qfull-Q)/2,3==BWTY)for(dtt=round(4*M),"MainLandCoast"==fn?M6Hth=RN.RNn(.28,.33):M6Hth=.28,ix=0;ix<Q-dtt*2;ix+=dtt)for(iy=0;iy<Q-dtt*2;iy+=dtt)rdx=3*M*RN.RNd(),rdy=3*M*RN.RNd(),noFill(),stroke(0),strokeWeight(.5*M),x1p=round(ix+rdx),y1p=round(iy+rdy),x2p=round(ix+2*rdx),y2p=round(iy+2*rdy),dix=round(ix+dtt/2),diyy=round(iy+dtt/2),stroke(.23,1,.53),strokeWeight(.35*M),1==BWCOL&&(H[dix][diyy]<.0725*Mxx&&H[dix][diyy]>.025*Mxx&&Grass(x1p,y1p,H[dix][diyy]/Mxx*3*6,1)),stroke(0),strokeWeight(.5*M),H[dix][diyy]<(M6Hth-.03)*Mxx&&H[dix][diyy]>.0725*Mxx&&LSCSH(x1p,y1p,H[dix][diyy]/Mxx*3*4,2),H[dix][diyy]>M6Hth*Mxx&&LSCSH(x1p,y1p,H[dix][diyy]/Mxx*3,1),stroke(205/360,1,.53),1==BWCOL&&(H[dix][diyy]<-5&&SECSH(x1p,y2p,min(H[dix][diyy]/Mnn*10,2),2))}function DisplayMap(){ConCol=[RN.RNn(.08,.157),RN.RNn(0,.05),RN.RNn(.92,1)],ConCol2=[RN.RNn(.08,.14),RN.RNn(0,.07),RN.RNn(.92,1)],createPaper(),CreateBorder(),image(Paper,0,0),9==MAPTYPE&&(MCGRID=RN.RNi(0,1),MineCraft(),image(Mcraft,xstart,ystart),image(MapBorder,0,0),sclcol=[0,.31]),8==MAPTYPE&&(NightMode(),image(GeoMap,xstart,ystart),image(NM,xstart,ystart),image(NM2,xstart,ystart),image(MapBorder,0,0),image(MapBorder,0,0),sclcol=[0,.31]),6==MAPTYPE&&(BWTY=3,BWCOL=RN.RNc([1,1,0]),LSB(),CreateRegionNames(),basicMapDetail(),image(SBI3,xstart,ystart),image(basicMap,xstart,ystart),Ncount>1&&(plotborders(),image(Borderimage,xstart,ystart)),image(Regions,xstart,ystart),image(MapBorder,0,0),sclcol=[0,.681]),5==MAPTYPE&&(sclcol=[0,.1],Tme=0,cloudseed=RN.RNi(1,1e9),PerlinSeed(cloudseed),P2=RN.RNn(.75,3),xspeed=RN.RNn(500,1e3)*RN.RNi(-1,1)/5,yspeed=RN.RNn(500,1e3)*RN.RNi(-1,1)/5,LSB(),plotborders(),CreateRegionNames(),GenShadowMap(),image(GeoMap,xstart,ystart),image(Borderimage,xstart,ystart),1!=Ncount&&image(SBI4,xstart+1,ystart+1),image(Regions,xstart,ystart),image(Shadow,xstart,ystart,Q,Q),image(MapBorder,0,0)),1==MAPTYPE&&(1==POLMAPUNDER&&image(PolMap,xstart,ystart),image(GeoMap,xstart,ystart),1!=Ncount&&(LSB(),image(SBI4,xstart+1,ystart+1)),plotborders(),image(Borderimage,xstart,ystart),RN.RNd()>0&&image(MapBorder,0,0),CreateRegionNames(),image(Regions,xstart,ystart),sclcol=[0,.3]),5!=MAPTYPE&&9!=MAPTYPE&&plotcoCRpass(.88*Qfull,.134*Qfull,22*M),5!=MAPTYPE&&6!=MAPTYPE&&7!=MAPTYPE&&8!=MAPTYPE&&9!=MAPTYPE&&plotscale(.8*Qfull,.89*Qfull,20*M)}function Island(){af=.3,bf=3,fas=3,hsm=1,hsb=1,Ncount=RN.RNc([1,1,1,1,1,1,1,1,3,2]),dxf=0,dyf=0,P=1+RN.RNn(-.25,1),RN.RNd()>.8?ACM=1:ACM=0,ACM2=RN.RNi(0,1),POLMAPUNDER=RN.RNi(0,1),PoliticalMessiness=RN.RNn(.5,2),MAPTYPE=RN.RNc([1,1,1,5,5,6,6,6,6,8]),SEAROUGHNESS=RN.RNn(0,1),terrainGen(),GenerateFalloffMap(),ScaleHeightsIsland(),FindMinMaxMeanCentre(H),ColourTerrain(),CreateBorders(),DisplayMap()}function MainlandCoast(){fas=1,hsm=1,hsb=1,af=3,bf=1.8,Ncount=RN.RNi(3,11),FSM=3,FSM=RN.RNi(1,2),1==FSM&&(dxf=M*RS()*330,dyf=M*RS()*RN.RNn(0,330)),2==FSM&&(dyf=M*RS()*330,dxf=M*RS()*RN.RNn(0,330)),3==FSM&&(dyf=M*RS()*299+RN.RNn(0,31),dxf=M*RS()*299+RN.RNn(0,31)),P=1+RN.RNn(-.25,1),RN.RNd()>.8?ACM=1:ACM=0,ACM2=RN.RNi(0,1),POLMAPUNDER=RN.RNi(0,1),PoliticalMessiness=RN.RNn(.5,2),MAPTYPE=RN.RNc([1,1,1,5,5,6]),SEAROUGHNESS=RN.RNn(0,1),terrainGen(),GenerateFalloffMap(),ScaleHeights(),FindMinMaxMeanCentre(H),ColourTerrain(),CreateBorders(),DisplayMap()}function Landlocked(){fas=0,hsm=2,hsb=-.21,af=3,bf=2.2,Ncount=RN.RNi(5,11),dxf=0,dyf=0,P=1+RN.RNn(-.25,1),RN.RNd()>.8?ACM=1:ACM=0,ACM2=RN.RNi(0,1),POLMAPUNDER=RN.RNi(0,1),PoliticalMessiness=RN.RNn(.5,2),MAPTYPE=RN.RNc([1,6,6,6,6]),SEAROUGHNESS=RN.RNn(0,1),terrainGen(),GenerateFalloffMap(),FindMinMaxMeanCentre(H),Normaliseheights(),fsb=-MNLH/CNTL*hsm,ScaleHeightsIsland(),FindMinMaxMeanCentre(H),ColourTerrain(),CreateBorders(),DisplayMap()}function SparseIslands(){fas=0,hsm=1,hsb=1,af=3,bf=2.2,Ncount=1,dxf=0,dyf=0,P=1+RN.RNn(-.25,1),RN.RNd()>.8?ACM=1:ACM=0,ACM2=RN.RNi(0,1),POLMAPUNDER=RN.RNi(0,1),PoliticalMessiness=RN.RNn(.5,2),MAPTYPE=RN.RNc([1,1,1,5,5,6,6,6,6,8]),SEAROUGHNESS=RN.RNn(0,1),terrainGen(),GenerateFalloffMap(),FindMinMaxMeanCentre(H),hsb=-MNLH/CNTS,ScaleHeightsIsland(),FindMinMaxMeanCentre(H),ColourTerrain(),CreateBorders(),DisplayMap()}function IslandChain(){af=.3,bf=3,fas=3,hsm=1,hsb=1,Ncount=RN.RNi(1,8),dxf=0,dyf=0,P=RN.RNn(1.5,2.5),RN.RNd()>.8?ACM=1:ACM=0,ACM2=RN.RNi(0,1),POLMAPUNDER=RN.RNi(0,1),PoliticalMessiness=RN.RNn(.5,2),MAPTYPE=RN.RNc([1,1,1,5,5,6,6,6,6,8]),SEAROUGHNESS=RN.RNn(0,1),terrainGen(),GenerateFalloffMap(),ScaleHeightsIsland(),FindMinMaxMeanCentre(H),ColourTerrain(),CreateBorders(),DisplayMap()}function terrainGen(){PerlinDetail(5,.5),H=[],Hd=[],CLgts=[],CLgts2=[];for(let j=0;j<Q;j++)H[j]=[],Hd[j]=[],CLgts[j]=[],CLgts2[j]=[];for(ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)striation1=8*Perlin(ix/400*xs*P,iy/400*xs*P),distort1=Perlin(ix/40*xs*P,iy/40*xs*P),noise1=Perlin(ix/100*xs*P,iy/100*xs*P,striation1+distort1),striation2=8*Perlin(ix/800*xs*P,iy/800*xs*P),distort2=Perlin(ix/80*xs*P,iy/80*xs*P),noise2=1.5*Perlin(ix/200*xs*P,iy/200*xs*P,striation2+distort2),roughness=Perlin(ix/600*xs*P,iy/600*xs*P)-.3,bumpdistort=Perlin(ix/20*xs*P,iy/20*xs*P),bumpnoise=Perlin(ix/50*xs*P,iy/50*xs*P,2*bumpdistort),h=noise1+sq(sq(noise2))+roughness*bumpnoise-.8,nx=floor(ix/200),ny=floor(iy/200),hg[ix+iy*Q]=h,hd=h-hg[max(0,ix+iy*Q-1*Q)],H[ix][iy]=h,Hd[ix][iy]=hd,CLgts2[ix][iy]=bumpnoise;for(PerlinSeed(1+RN.RNi(1,1e9)),ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)CLgts[ix][iy]=Perlin(ix/20*xs*P,iy/20*xs*P);return H,Hd}CTTHR=0,CTTHR2=0,CTTHR3=0,CTTHR4=0,hg=[],DEFAULT_SIZE=1e3,Qfull=Math.min(window.innerWidth,window.innerHeight),PP=2,M=Qfull/DEFAULT_SIZE,FNt=0,setup=_=>{density=displayDensity(),RN=new Random,BorderSize=.09,Q=Math.round((1-2*BorderSize)*Qfull),xs=1/M,console.log(Qfull,Q),xstart=ystart=BorderSize*Qfull,Globalw=2*Math.round(Q/1e3)*1.1,colorMode(HSB,1),createCanvas(Qfull,Qfull),Mxx=0,CCol=0,RN.RNd(),ConCol3=[.1,.05,1],fn=["Island","Island Chain","SparseIslands","Island","Island Chain","SparseIslands","Island","Island Chain","SparseIslands","Landlocked","MainLandCoast"],fn=RN.RNc(fn),"Island"==fn&&Island(),"MainLandCoast"==fn&&MainlandCoast(),"Island Chain"==fn&&IslandChain(),"Landlocked"==fn&&Landlocked(),"SparseIslands"==fn&&SparseIslands()};var _,x=4095,w=4,S=.5;let RN=new Random;function Perlin(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(null==_){_=new Array(4096);for(var n=0;n<4096;n++)_[n]=RN.RNd()}e<0&&(e=-e),t<0&&(t=-t),r<0&&(r=-r);for(var o,i,a,s,l,u=Math.floor(e),c=Math.floor(t),d=Math.floor(r),f=e-u,h=t-c,p=r-d,y=0,m=.5,g=0;g<w;g++){var v=u+(c<<4)+(d<<8);o=b(f),i=b(h),a=_[v&x],a+=o*(_[v+1&x]-a),s=_[v+16&x],a+=i*((s+=o*(_[v+16+1&x]-s))-a),s=_[(v+=256)&x],s+=o*(_[v+1&x]-s),l=_[v+16&x],s+=i*((l+=o*(_[v+16+1&x]-l))-s),y+=(a+=b(p)*(s-a))*m,m*=S,u<<=1,c<<=1,d<<=1,1<=(f*=2)&&(u++,f--),1<=(h*=2)&&(c++,h--),1<=(p*=2)&&(d++,p--)}return y}function b(e){return.5*(1-Math.cos(e*Math.PI))}function PerlinDetail(e,t){0<e&&(w=e),0<t&&(S=t)}function PerlinSeed(e){var t,r,n,o=(n=4294967296,{setSeed:function(e){r=t=(null==e?RN.RNd()*n:e)>>>0},getSeed:function(){return t},rand:function(){return(r=(1664525*r+1013904223)%n)/n}});o.setSeed(e),_=new Array(4096);for(var i=0;i<4096;i++)_[i]=o.rand()}function ColourTerrain(){if(RN=new Random,CheckForLand(H),dHf=abs(MXLD)+RN.RNn(.5,1),OFFAP=0,MXLD<.45){for(OFFAP=1,ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)H[ix][iy]=dHf+H[ix][iy];FindMinMaxMeanCentre(H)}for(GeoMap=createGraphics(width,height),SHUE=RN.RNn(.5,.7),SSAT=RN.RNn(.2,.4),HUE=RN.RNn(.15,.25),SAT=.4,TRP=RN.RNn(.9,1),GeoMap.noStroke(),landBright=0,landPixel=0,ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)1==ACM&&(f=min(45,max(-45/255,175*(Perlin(ix*xs/450+3,iy*xs/450+5)-.5)/255)),f=abs(f/(45/255))*f),colorMode(HSB,1),LUM=.3+.25*H[ix][iy],H[ix][iy]>0?(nc=color(HUE,SAT,LUM,1==POLMAPUNDER&&0==ACM&&0==ACM2?TRP:1),1==ACM&&(nc=color((65/255+f)*(1-h/220),130/255+1.75*f-.5*h,130/255-f-h/1.4+sq(h/19))),nc=lerpColor(nc,color(Hd[ix][iy]>0?1:0),sqrt(abs(Hd[ix][iy]))),GeoMap.f