0xf4dc…4d2e

All memos sent from and to 0xf4dc…4d2e.

function setup(){let S=Uint32Array.from([0,1,ss=tt=2,3].map((tt=>parseInt(tokenData.hash.substr(8*tt+2,8),16))));function RC(q){return q[Math.floor(R()*q.length)]}function RR(q,n){return q+R()*(n-q)}R=q=>(tt=S[3],S[3]=S[2],S[2]=S[1],S[1]=ss=S[0],tt^=tt<<11,S[0]^=tt^tt>>>8^ss>>>19,S[0]/2**32);noCanvas(),noLoop();let e=parseInt(tokenData.hash.slice(0,16),16);randomSeed(e);console.log("e=",e);let o=1100;for(function(){points=[],col=[],SHOWSIDE=[],STWdt=[],La=Lb=[3,5,7,11,13,17,19,23,27,39,51,59,69,77,101,81,89,95],Lc=Ld=[2].concat(La),M=1,a=b=c=d=0;for(;1==(a==b||a==c||a==d||b==c||b==d||c==d)||a+b+c+d<=29||a+b==5||a+b>39||abs(a-b)>17||a+b+c+d>=72;)a=RC(La),b=RC(Lb),c=RC(Lc),d=RC(Ld),d=RC(Ld),colorMode(HSB,1);alph=a,beta=b,gamm=c}(),ThreeFaced=RC([0,0,0,0,0,0,0,0,0,1]),DASHEDLINE=RC([0,0,0,0,0,0,1,2]),INDECISIVE=R()>.8,TINTEDPAPER=R()>.5,BGBW=R()>.65,1==ThreeFaced?BWLines=R()>.6:BWLines=R()>.9,1==ThreeFaced&&1!=BWLines&&(BGBW=R()>.3,console.log(BGBW)),AltPalette=R()>.5,1==BWLines&&(AltPalette=0),SC=1.5,OVERLAPFACES=R()>0.9,OVERLAPFACES==1?(Over6=-1.0125,TINTEDPAPER=0,ThreeFaced=0):Over6=1,t=0,dt=.001,1==INDECISIVE?(r=.01*M,r2=0*M):(r=0,r2=0),angleX=-(25+.5*RR(-10,15))/180*PI,angleY=-(40+.5*RR(-35,35))/180*PI,angleZ=0,distance=1.5*RR(2,10),ScalFactor=100*RR(.95,1.41)*distance*2,distance=6,ScalFactor=1300,abs(180*angleY/PI+45)<2&&(angleY=-.25*PI+(3+RR(0,3))/180*PI),R()>.8&&(CuratedMode=RC([0,1,2,3,4,5]),function(){switch(CuratedMode){case 0:angleX=-.25*PI,angleY=-30/180*PI,angleZ=0*PI;break;case 1:angleX=-30/180*PI,angleY=-.25*PI,angleZ=0*PI;break;case 2:angleX=-.25*PI,angleY=-.25*PI,angleZ=0*PI;break;case 3:angleX=-30/180*PI,angleY=-30/180*PI,angleZ=0*PI;break;case 4:angleX=-.125*PI,angleY=-.25*PI,angleZ=0*PI;break;case 5:angleX=-35/180*PI,angleY=-.25*PI,angleZ=0*PI}}()),i=0;i<6;i++)points[i]=[];for(t=0,it=0;t<TAU;t+=dt,it++)x=M*RR(-r,r)+M*cos(t*alph),y=M*RR(-r,r)+M*sin(t*beta),points[0][it]=createVector(x+RR(-r2,r2),y+RR(-r2,r2),-M*Over6),points[3][it]=createVector(M,y+RR(-r2,r2),x+RR(-r2,r2)),points[5][it]=createVector(x+RR(-r2,r2),y+RR(-r2,r2),M),points[1][it]=createVector(-M*Over6,y+RR(-r2,r2),x+RR(-r2,r2)),points[2][it]=createVector(y+RR(-r2,r2),M*Over6,x+RR(-r2,r2)),points[4][it]=createVector(y+RR(-r2,r2),-M,x+RR(-r2,r2));gr=color(.33,1,1),oran=color(32/360,1,1),pur=color(.8,.81,1),cyn=color(.49,.95,.95),Colours=[gr,"blue","red","yellow",cyn,"magenta"],colorNames=["Green","Blue","Red","Yellow","Cyan","Magenta"],1==AltPalette&&(Colours=[gr,oran,pur,"blue","yellow","red"],colorNames=["Green","Orange","Purple","Blue","Yellow","Red"]),TFM=RR([1,2,3,4]),1==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red","blue",gr,"yellow"],colorNames=["Green","Blue","Red","Blue","Green","Yellow"]),2==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red",gr,cyn,"yellow"],colorNames=["Green","Blue","Red","Green","Cyan","Yellow"]),3==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red","blue",pur,"red"],colorNames=["Green","Blue","Red","Blue","Purple","Red"]),4==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red",color([.073,.91,1]),color([.9,.71,1]),color([1/6,.71,1])],colorNames=["Green","Blue","Red","Orange","Pink","Yellow"]),1==TINTEDPAPER?ConCol3=[R(),.05,1]:ConCol3=[.1,.025,1],1==ThreeFaced?SHOWSIDE=[1,1,1,0,0,0]:SHOWSIDE=[0,0,0,0,0,0],1==BGBW?1==TINTEDPAPER?ConCol3=[RC([,.15,.4,.45,.5,.6,.7,.8,.9]),.81,.01]:ConCol3=[0,0,.05]:ConCol3=ConCol3,1==BGBW&&1==BWLines&&(Colours=["white","white","white","white","white","white"]),0==BGBW&&1==BWLines&&(Colours=["black","black","black","black","black","black"]), OVERLAPFACES==1?(Colours = ["yellow", "blue", "magenta", gr, cyn, "red"], colorNames = ["Yellow", "Blue", "Magenta", "Green", "Cyan", "Red"]):0, noFill();let n="http://www.w3.org/2000/svg",l=document.createElementNS(n,"svg");l.setAttribute("width","100vw"),l.setAttribute("height","100vh"),l.setAttribute("viewBox","0 0 850 "+o),l.setAttribute("style","background-color:white;");let s=document.createElementNS(n,"path");s.setAttribute("d","M 0 0 M 850 1100"),l.appendChild(s);let u=1/0,m=-1/0,g=[];for(let e=0;e<6;e++){let t=C(points[e],e,0);g.push(t.projected),u=min(u,t.minX),m=max(m,t.maxX)}let h=-((u+m)/2);for(let e=0;e<6;e++)for(let t=0;t<g[e].length;t++)g[e][t].x+=h;let I=function(e,t,r){let o=r*t,n=o*(1-Math.abs(6*e%2-1)),l=r-o,[a,d,c]=[0,0,0];0<=6*e&&6*e<1?[a,d,c]=[o,n,0]:1<=6*e&&6*e<2?[a,d,c]=[n,o,0]:2<=6*e&&6*e<3?[a,d,c]=[0,o,n]:3<=6*e&&6*e<4?[a,d,c]=[0,n,o]:4<=6*e&&6*e<5?[a,d,c]=[n,0,o]:5<=6*e&&6*e<6&&([a,d,c]=[o,0,n]);return a=Math.round(255*(a+l)),d=Math.round(255*(d+l)),c=Math.round(255*(c+l)),`rgb(${a}, ${d}, ${c})`}(ConCol3[0],ConCol3[1],ConCol3[2]);for(l.setAttribute("style",`background-color:${I};`),i=0;i<6;i++){let e=g[i],t=document.createElementNS(n,"g");t.setAttribute("id",colorNames[i]);let r=SC*M*1,o=1==SHOWSIDE[i]?"none":Colours[i];if(0===DASHEDLINE&&0==SHOWSIDE[i]){let l=document.createElementNS(n,"path");l.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`);let a="M "+(e[0].x+425)+" "+(e[0].y+550);for(let t=1;t<e.length;t++){let r=e[t];a+=" L "+(r.x+425)+" "+(r.y+550)}l.setAttribute("d",a),t.appendChild(l)}if(2===DASHEDLINE&&0==SHOWSIDE[i])for(let l=0;l<e.length-1;l++){let a=e[l],d=e[l+1],c=document.createElementNS(n,"path");c.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`),c.setAttribute("d",`M ${a.x+425} ${a.y+550} L ${d.x+425} ${d.y+550}`),t.appendChild(c)}if(1===DASHEDLINE&&0==SHOWSIDE[i])for(let l=0;l<e.length-1;l++){let a=e[l],d=e[l+1];if(l%2==0){let e=document.createElementNS(n,"path");e.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`),e.setAttribute("d",`M ${a.x+425} ${a.y+550} L ${d.x+425} ${d.y+550}`),t.appendChild(e)}}l.appendChild(t)}function C(e,t,r){const o=[[cos(angleZ),-sin(angleZ),0],[sin(angleZ),cos(angleZ),0],[0,0,1]],n=[[1,0,0],[0,cos(angleX),-sin(angleX)],[0,sin(angleX),cos(angleX)]],l=[[cos(angleY),0,sin(angleY)],[0,1,0],[-sin(angleY),0,cos(angleY)]];let a=[];for(let t=0;t<e.length;t++){let r=P(l,e[t]);r=P(n,r),r=P(o,r);let d=1/(distance-r.z);let c=P([[d,0,0],[0,d,0]],r);c.mult(ScalFactor),a[t]=c}let d=1/0,c=-1/0;for(let e=0;e<a.length;e++)d=min(d,a[e].x),c=max(c,a[e].x);return{projected:a,minX:d,maxX:c}}function p(e,t){return function(e){return createVector(e[0][0],e[1][0],e.length>2?e[2][0]:0)}(P(e,function(e){let t=[];for(let e=0;e<3;e++)t[e]=[];return t[0][0]=e.x,t[1][0]=e.y,t[2][0]=e.z,t}(t)))}function P(e,t){if(t instanceof p5.Vector)return p(e,t);let r=e[0].length,o=e.length,n=t[0].length;if(r!==t.length)return null;result=[];for(let l=0;l<o;l++){result[l]=[];for(let o=0;o<n;o++){let n=0;for(let a=0;a<r;a++)n+=e[l][a]*t[a][o];result[l][o]=n}}return result}document.body.appendChild(l)}
function setup(){noCanvas(),noLoop();let e=parseInt(tokenData.hash.slice(0,16),16);randomSeed(e);let o=1100;for(function(){points=[],col=[],SHOWSIDE=[],STWdt=[],La=Lb=[3,5,7,11,13,17,19,23,27,39,51,59,69,77,101,81,89,95],Lc=Ld=[2].concat(La),M=1,a=b=c=d=0;for(;1==(a==b||a==c||a==d||b==c||b==d||c==d)||a+b+c+d<=29||a+b==5||a+b>39||abs(a-b)>17||a+b+c+d>=72;)a=random(La),b=random(Lb),c=random(Lc),d=random(Ld),colorMode(HSB,1);alph=a,beta=b,gamm=c}(),ThreeFaced=random([0,0,0,0,0,0,0,0,0,1]),DASHEDLINE=random([0,0,0,0,0,0,1,2]),INDECISIVE=random()>.8,TINTEDPAPER=random()>.5,BGBW=random()>.65,1==ThreeFaced?BWLines=random()>.6:BWLines=random()>.9,1==ThreeFaced&&1!=BWLines&&(BGBW=random()>.3,console.log(BGBW)),AltPalette=random()>.5,1==BWLines&&(AltPalette=0),SC=1.5,OVERLAPFACES=random()>0.9,OVERLAPFACES==1?(Over6=-1.03,TINTEDPAPER=0,ThreeFaced=0):Over6=1,t=0,dt=.001,1==INDECISIVE?(r=.01*M,r2=0*M):(r=0,r2=0),angleX=-(25+.5*random(-10,15))/180*PI,angleY=-(40+.5*random(-35,35))/180*PI,angleZ=0,distance=1.5*random(2,10),ScalFactor=100*random(.95,1.41)*distance*2,distance=6,ScalFactor=1300,abs(180*angleY/PI+45)<2&&(angleY=-.25*PI+(3+random(0,3))/180*PI),random()>.8&&(CuratedMode=random([0,1,2,3,4,5]),function(){switch(CuratedMode){case 0:angleX=-.25*PI,angleY=-30/180*PI,angleZ=0*PI;break;case 1:angleX=-30/180*PI,angleY=-.25*PI,angleZ=0*PI;break;case 2:angleX=-.25*PI,angleY=-.25*PI,angleZ=0*PI;break;case 3:angleX=-30/180*PI,angleY=-30/180*PI,angleZ=0*PI;break;case 4:angleX=-.125*PI,angleY=-.25*PI,angleZ=0*PI;break;case 5:angleX=-35/180*PI,angleY=-.25*PI,angleZ=0*PI}}()),i=0;i<6;i++)points[i]=[];for(t=0,it=0;t<TAU;t+=dt,it++)x=M*random(-r,r)+M*cos(t*alph),y=M*random(-r,r)+M*sin(t*beta),points[0][it]=createVector(x+random(-r2,r2),y+random(-r2,r2),-M*Over6),points[3][it]=createVector(M,y+random(-r2,r2),x+random(-r2,r2)),points[5][it]=createVector(x+random(-r2,r2),y+random(-r2,r2),M),points[1][it]=createVector(-M*Over6,y+random(-r2,r2),x+random(-r2,r2)),points[2][it]=createVector(y+random(-r2,r2),M*Over6,x+random(-r2,r2)),points[4][it]=createVector(y+random(-r2,r2),-M,x+random(-r2,r2));gr=color(.33,1,1),oran=color(32/360,1,1),pur=color(.8,.81,1),cyn=color(.49,.95,.95),Colours=[gr,"blue","red","yellow",cyn,"magenta"],colorNames=["Green","Blue","Red","Yellow","Cyan","Magenta"],1==AltPalette&&(Colours=[gr,oran,pur,"blue","yellow","red"],colorNames=["Green","Orange","Purple","Blue","Yellow","Red"]),TFM=random([1,2,3,4]),1==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red","blue",gr,"yellow"],colorNames=["Green","Blue","Red","Blue","Green","Yellow"]),2==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red",gr,cyn,"yellow"],colorNames=["Green","Blue","Red","Green","Cyan","Yellow"]),3==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red","blue",pur,"red"],colorNames=["Green","Blue","Red","Blue","Purple","Red"]),4==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red",color([.073,.91,1]),color([.9,.71,1]),color([1/6,.71,1])],colorNames=["Green","Blue","Red","Orange","Pink","Yellow"]),1==TINTEDPAPER?ConCol3=[random(),.05,1]:ConCol3=[.1,.025,1],1==ThreeFaced?SHOWSIDE=[1,1,1,0,0,0]:SHOWSIDE=[0,0,0,0,0,0],1==BGBW?1==TINTEDPAPER?ConCol3=[random([,.15,.4,.45,.5,.6,.7,.8,.9]),.81,.01]:ConCol3=[0,0,.05]:ConCol3=ConCol3,1==BGBW&&1==BWLines&&(Colours=["white","white","white","white","white","white"]),0==BGBW&&1==BWLines&&(Colours=["black","black","black","black","black","black"]), OVERLAPFACES==1?(Colours = ["yellow", "blue", "magenta", gr, cyn, "red"], colorNames = ["Yellow", "Blue", "Magenta", "Green", "Cyan", "Red"]):0, noFill();let n="http://www.w3.org/2000/svg",l=document.createElementNS(n,"svg");l.setAttribute("width","100vw"),l.setAttribute("height","100vh"),l.setAttribute("viewBox","0 0 850 "+o),l.setAttribute("style","background-color:white;");let s=document.createElementNS(n,"path");s.setAttribute("d","M 0 0 M 850 1100"),l.appendChild(s);let u=1/0,m=-1/0,g=[];for(let e=0;e<6;e++){let t=C(points[e],e,0);g.push(t.projected),u=min(u,t.minX),m=max(m,t.maxX)}let h=-((u+m)/2);for(let e=0;e<6;e++)for(let t=0;t<g[e].length;t++)g[e][t].x+=h;let I=function(e,t,r){let o=r*t,n=o*(1-Math.abs(6*e%2-1)),l=r-o,[a,d,c]=[0,0,0];0<=6*e&&6*e<1?[a,d,c]=[o,n,0]:1<=6*e&&6*e<2?[a,d,c]=[n,o,0]:2<=6*e&&6*e<3?[a,d,c]=[0,o,n]:3<=6*e&&6*e<4?[a,d,c]=[0,n,o]:4<=6*e&&6*e<5?[a,d,c]=[n,0,o]:5<=6*e&&6*e<6&&([a,d,c]=[o,0,n]);return a=Math.round(255*(a+l)),d=Math.round(255*(d+l)),c=Math.round(255*(c+l)),`rgb(${a}, ${d}, ${c})`}(ConCol3[0],ConCol3[1],ConCol3[2]);for(l.setAttribute("style",`background-color:${I};`),i=0;i<6;i++){let e=g[i],t=document.createElementNS(n,"g");t.setAttribute("id",colorNames[i]);let r=SC*M*1,o=1==SHOWSIDE[i]?"none":Colours[i];if(0===DASHEDLINE&&0==SHOWSIDE[i]){let l=document.createElementNS(n,"path");l.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`);let a="M "+(e[0].x+425)+" "+(e[0].y+550);for(let t=1;t<e.length;t++){let r=e[t];a+=" L "+(r.x+425)+" "+(r.y+550)}l.setAttribute("d",a),t.appendChild(l)}if(2===DASHEDLINE&&0==SHOWSIDE[i])for(let l=0;l<e.length-1;l++){let a=e[l],d=e[l+1],c=document.createElementNS(n,"path");c.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`),c.setAttribute("d",`M ${a.x+425} ${a.y+550} L ${d.x+425} ${d.y+550}`),t.appendChild(c)}if(1===DASHEDLINE&&0==SHOWSIDE[i])for(let l=0;l<e.length-1;l++){let a=e[l],d=e[l+1];if(l%2==0){let e=document.createElementNS(n,"path");e.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`),e.setAttribute("d",`M ${a.x+425} ${a.y+550} L ${d.x+425} ${d.y+550}`),t.appendChild(e)}}l.appendChild(t)}function C(e,t,r){const o=[[cos(angleZ),-sin(angleZ),0],[sin(angleZ),cos(angleZ),0],[0,0,1]],n=[[1,0,0],[0,cos(angleX),-sin(angleX)],[0,sin(angleX),cos(angleX)]],l=[[cos(angleY),0,sin(angleY)],[0,1,0],[-sin(angleY),0,cos(angleY)]];let a=[];for(let t=0;t<e.length;t++){let r=P(l,e[t]);r=P(n,r),r=P(o,r);let d=1/(distance-r.z);let c=P([[d,0,0],[0,d,0]],r);c.mult(ScalFactor),a[t]=c}let d=1/0,c=-1/0;for(let e=0;e<a.length;e++)d=min(d,a[e].x),c=max(c,a[e].x);return{projected:a,minX:d,maxX:c}}function p(e,t){return function(e){return createVector(e[0][0],e[1][0],e.length>2?e[2][0]:0)}(P(e,function(e){let t=[];for(let e=0;e<3;e++)t[e]=[];return t[0][0]=e.x,t[1][0]=e.y,t[2][0]=e.z,t}(t)))}function P(e,t){if(t instanceof p5.Vector)return p(e,t);let r=e[0].length,o=e.length,n=t[0].length;if(r!==t.length)return null;result=[];for(let l=0;l<o;l++){result[l]=[];for(let o=0;o<n;o++){let n=0;for(let a=0;a<r;a++)n+=e[l][a]*t[a][o];result[l][o]=n}}return result}document.body.appendChild(l)}
Since first encountering Lissajous curves on an oscilloscope in the mid-2000s, I have been fascinated by the intricate patterns and structures that emerge from one of the most fundamental curves in mathematics, the sine curve. Lissajous curves are a family of complex, looping shapes formed by the intersection of two sine waves. This fascination inspired me to create this generative art project entitled "Lissajous," where I have experimented extensively with these curves as primitive shapes to craft a diverse range of images showcasing their beauty and complexity. By adjusting the frequency, phase shift, and amplitude of the parametric equations, it is possible to create unique and mesmerizing patterns. Over the years, I have explored various ways to bring these images to life. Some have been transformed into physical prints, utilizing techniques such as intaglio printing, cyanotypes, and various other printmaking methods, while others have been realized as digital monoprints. This iteration of the project features carefully curated color palettes and themes designed specifically with the AxiDraw plotter in mind. Each piece in the collection allows for customization, providing the opportunity to choose from different base colors and select the pen and paper that best fits the holder's individual taste. #### Suggestions for Plotting - Paper and Pens **Black paper:** - Fabriano Black Pad, 11.75" x 16.5" **Best pens for black paper:** - SAKURA - Gelly Roll - Posca PC-1MR Metallic Pink Colour Paint Marker (Archival) **White Paper:** - BFK Rives Blanc - Somerset Satin Soft White **Pens for white paper:** - Triplus Fineliner Superfine - WHSmith Drawing Pens Pigment Ink (Archival) - STABILO point 88 Fineliner - BIC Cristal Any of the pens suggested for black paper will also work on the white paper, but the black paper requires pens with opaque inks. #### Prints Signed prints will be available to any token holder interested in purchasing one. Please reach out to me on Discord or Twitter, I will be happy to take into account any customizations or requests before plotting the piece with my AxiDraw.
function setup(){noCanvas(),noLoop();let e=parseInt(tokenData.hash.slice(0,16),16);randomSeed(e);let o=1100;for(function(){points=[],col=[],SHOWSIDE=[],STWdt=[],La=Lb=[3,5,7,11,13,17,19,23,27,39,51,59,69,77,101,81,89,95],Lc=Ld=[2].concat(La),M=1,a=b=c=d=0;for(;1==(a==b||a==c||a==d||b==c||b==d||c==d)||a+b+c+d<=29||a+b==5||a+b>39||abs(a-b)>17||a+b+c+d>=72;)a=random(La),b=random(Lb),c=random(Lc),d=random(Ld),colorMode(HSB,1);alph=a,beta=b,gamm=c}(),ThreeFaced=random([0,0,0,0,0,0,0,0,0,1]),DASHEDLINE=random([0,0,0,0,0,0,1,2]),INDECISIVE=random()>.8,TINTEDPAPER=random()>.5,BGBW=random()>.65,1==ThreeFaced?BWLines=random()>.6:BWLines=random()>.9,1==ThreeFaced&&1!=BWLines&&(BGBW=random()>.3,console.log(BGBW)),AltPalette=random()>.5,1==BWLines&&(AltPalette=0),SC=1.5,OVERLAPFACES=random()>0.95,OVERLAPFACES==1?(Over6=-1.01,TINTEDPAPER=0,ThreeFaced=0):Over6=1,t=0,dt=.001,1==INDECISIVE?(r=.01*M,r2=0*M):(r=0,r2=0),angleX=-(25+.5*random(-10,15))/180*PI,angleY=-(40+.5*random(-35,35))/180*PI,angleZ=0,distance=1.5*random(2,10),ScalFactor=100*random(.95,1.41)*distance*2,distance=6,ScalFactor=1300,abs(180*angleY/PI+45)<2&&(angleY=-.25*PI+(3+random(0,3))/180*PI),random()>.8&&(CuratedMode=random([0,1,2,3,4,5]),function(){switch(CuratedMode){case 0:angleX=-.25*PI,angleY=-30/180*PI,angleZ=0*PI;break;case 1:angleX=-30/180*PI,angleY=-.25*PI,angleZ=0*PI;break;case 2:angleX=-.25*PI,angleY=-.25*PI,angleZ=0*PI;break;case 3:angleX=-30/180*PI,angleY=-30/180*PI,angleZ=0*PI;break;case 4:angleX=-.125*PI,angleY=-.25*PI,angleZ=0*PI;break;case 5:angleX=-35/180*PI,angleY=-.25*PI,angleZ=0*PI}}()),i=0;i<6;i++)points[i]=[];for(t=0,it=0;t<TAU;t+=dt,it++)x=M*random(-r,r)+M*cos(t*alph),y=M*random(-r,r)+M*sin(t*beta),points[0][it]=createVector(x+random(-r2,r2),y+random(-r2,r2),-M*Over6),points[3][it]=createVector(M,y+random(-r2,r2),x+random(-r2,r2)),points[5][it]=createVector(x+random(-r2,r2),y+random(-r2,r2),M),points[1][it]=createVector(-M*Over6,y+random(-r2,r2),x+random(-r2,r2)),points[2][it]=createVector(y+random(-r2,r2),M*Over6,x+random(-r2,r2)),points[4][it]=createVector(y+random(-r2,r2),-M,x+random(-r2,r2));gr=color(.33,1,1),oran=color(32/360,1,1),pur=color(.8,.81,1),cyn=color(.49,.95,.95),Colours=[gr,"blue","red","yellow",cyn,"magenta"],colorNames=["Green","Blue","Red","Yellow","Cyan","Magenta"],1==AltPalette&&(Colours=[gr,oran,pur,"blue","yellow","red"],colorNames=["Green","Orange","Purple","Blue","Yellow","Red"]),TFM=random([1,2,3,4]),1==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red","blue",gr,"yellow"],colorNames=["Green","Blue","Red","Blue","Green","Yellow"]),2==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red",gr,cyn,"yellow"],colorNames=["Green","Blue","Red","Green","Cyan","Yellow"]),3==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red","blue",pur,"red"],colorNames=["Green","Blue","Red","Blue","Purple","Red"]),4==TFM&&1==ThreeFaced&&(Colours=[gr,"blue","red",color([.073,.91,1]),color([.9,.71,1]),color([1/6,.71,1])],colorNames=["Green","Blue","Red","Orange","Pink","Yellow"]),1==TINTEDPAPER?ConCol3=[random(),.05,1]:ConCol3=[.1,.025,1],1==ThreeFaced?SHOWSIDE=[1,1,1,0,0,0]:SHOWSIDE=[0,0,0,0,0,0],1==BGBW?1==TINTEDPAPER?ConCol3=[random([,.15,.4,.45,.5,.6,.7,.8,.9]),.81,.01]:ConCol3=[0,0,.05]:ConCol3=ConCol3,1==BGBW&&1==BWLines&&(Colours=["white","white","white","white","white","white"]),0==BGBW&&1==BWLines&&(Colours=["black","black","black","black","black","black"]), OVERLAPFACES==1?(Colours = ["yellow", "blue", "magenta", gr, cyn, "red"], colorNames = ["Yellow", "Blue", "Magenta", "Green", "Cyan", "Red"]):0, noFill();let n="http://www.w3.org/2000/svg",l=document.createElementNS(n,"svg");l.setAttribute("width","100vw"),l.setAttribute("height","100vh"),l.setAttribute("viewBox","0 0 850 "+o),l.setAttribute("style","background-color:white;");let s=document.createElementNS(n,"path");s.setAttribute("d","M 0 0 M 850 1100"),l.appendChild(s);let u=1/0,m=-1/0,g=[];for(let e=0;e<6;e++){let t=C(points[e],e,0);g.push(t.projected),u=min(u,t.minX),m=max(m,t.maxX)}let h=-((u+m)/2);for(let e=0;e<6;e++)for(let t=0;t<g[e].length;t++)g[e][t].x+=h;let I=function(e,t,r){let o=r*t,n=o*(1-Math.abs(6*e%2-1)),l=r-o,[a,d,c]=[0,0,0];0<=6*e&&6*e<1?[a,d,c]=[o,n,0]:1<=6*e&&6*e<2?[a,d,c]=[n,o,0]:2<=6*e&&6*e<3?[a,d,c]=[0,o,n]:3<=6*e&&6*e<4?[a,d,c]=[0,n,o]:4<=6*e&&6*e<5?[a,d,c]=[n,0,o]:5<=6*e&&6*e<6&&([a,d,c]=[o,0,n]);return a=Math.round(255*(a+l)),d=Math.round(255*(d+l)),c=Math.round(255*(c+l)),`rgb(${a}, ${d}, ${c})`}(ConCol3[0],ConCol3[1],ConCol3[2]);for(l.setAttribute("style",`background-color:${I};`),i=0;i<6;i++){let e=g[i],t=document.createElementNS(n,"g");t.setAttribute("id",colorNames[i]);let r=SC*M*1,o=1==SHOWSIDE[i]?"none":Colours[i];if(0===DASHEDLINE&&0==SHOWSIDE[i]){let l=document.createElementNS(n,"path");l.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`);let a="M "+(e[0].x+425)+" "+(e[0].y+550);for(let t=1;t<e.length;t++){let r=e[t];a+=" L "+(r.x+425)+" "+(r.y+550)}l.setAttribute("d",a),t.appendChild(l)}if(2===DASHEDLINE&&0==SHOWSIDE[i])for(let l=0;l<e.length-1;l++){let a=e[l],d=e[l+1],c=document.createElementNS(n,"path");c.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`),c.setAttribute("d",`M ${a.x+425} ${a.y+550} L ${d.x+425} ${d.y+550}`),t.appendChild(c)}if(1===DASHEDLINE&&0==SHOWSIDE[i])for(let l=0;l<e.length-1;l++){let a=e[l],d=e[l+1];if(l%2==0){let e=document.createElementNS(n,"path");e.setAttribute("style",`fill:none;stroke-width:${r};stroke:${o}`),e.setAttribute("d",`M ${a.x+425} ${a.y+550} L ${d.x+425} ${d.y+550}`),t.appendChild(e)}}l.appendChild(t)}function C(e,t,r){const o=[[cos(angleZ),-sin(angleZ),0],[sin(angleZ),cos(angleZ),0],[0,0,1]],n=[[1,0,0],[0,cos(angleX),-sin(angleX)],[0,sin(angleX),cos(angleX)]],l=[[cos(angleY),0,sin(angleY)],[0,1,0],[-sin(angleY),0,cos(angleY)]];let a=[];for(let t=0;t<e.length;t++){let r=P(l,e[t]);r=P(n,r),r=P(o,r);let d=1/(distance-r.z);let c=P([[d,0,0],[0,d,0]],r);c.mult(ScalFactor),a[t]=c}let d=1/0,c=-1/0;for(let e=0;e<a.length;e++)d=min(d,a[e].x),c=max(c,a[e].x);return{projected:a,minX:d,maxX:c}}function p(e,t){return function(e){return createVector(e[0][0],e[1][0],e.length>2?e[2][0]:0)}(P(e,function(e){let t=[];for(let e=0;e<3;e++)t[e]=[];return t[0][0]=e.x,t[1][0]=e.y,t[2][0]=e.z,t}(t)))}function P(e,t){if(t instanceof p5.Vector)return p(e,t);let r=e[0].length,o=e.length,n=t[0].length;if(r!==t.length)return null;result=[];for(let l=0;l<o;l++){result[l]=[];for(let o=0;o<n;o++){let n=0;for(let a=0;a<r;a++)n+=e[l][a]*t[a][o];result[l][o]=n}}return result}document.body.appendChild(l)}
Cryptocountries is a limited-edition series of digital prints using the medium of generative art. Each map is created by first procedurally generating a terrain height map and then rendering a map in a range of different styles and colours. Each print derives its randomness from a corresponding hash constraining the infinite possibilities for each print in the edition to a single unique image. The series invites the observer to lose themselves in a selection of maps and annotated photographs from the unorganized archives that loosely chronicle the travels of a stranger in a mythical land. ## Prints All original token holders that mint a piece over 1.5 Ξ will be eligible for a single edition (1/1) handmade signed print of their edition using a printmaking technique suitable for the style of image (intaglio etching, screenprint, cyanotype, etc.). The token holder will be consulted in the creation of their print. Size, paper choice, type of ink and even colours can be customized and chosen to suit the token holder's preferences. In addition, free signed digital prints on archival paper will be available to the following collectors - All original holders that mint over 0.6 Ξ will receive a large signed digital print - All original holders that mint over 0.3 Ξ will receive a medium signed digital print All token holders will be able to purchase a signed print of any mint they currently own. More information on prints can be found [here](https://www.michaelgdevereux.com/cryptocountries-prints).
Cryptocountries is a limited-edition series of digital prints using the medium of generative art. Each map is created by first procedurally generating a terrain height map and then rendering a map in a range of different styles and colours. Each print derives its randomness from a corresponding hash constraining the infinite possibilities for each print in the edition to a single unique image. The series invites the observer to lose themselves in a selection of maps and annotated photographs from the unorganized archives that loosely chronicle the travels of a stranger in a mythical land. ## Prints All original token holders that mint a piece over 1.75 Ξ will be eligible for a single edition (1/1) handmade signed print of their edition using a printmaking technique suitable for the style of image (intaglio etching, screenprint, cyanotype, etc.). The token holder will be consulted in the creation of their print. Size, paper choice, type of ink and even colours can be customized and chosen to suit the token holder's preferences. In addition, free signed digital prints on archival paper will be available to the following collectors - All original holders that mint over 1 Ξ will receive a large signed digital print - All original holders that mint over 0.5 Ξ will receive a medium signed digital print All token holders will be able to purchase a signed print of any mint they currently own. More information on prints can be found [here](https://www.michaelgdevereux.com/cryptocountries-prints).
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
Cryptocountries is a limited-edition series of digital prints using the medium of generative art. Each map is created by first procedurally generating a terrain height map and then rendering a map in a range of different styles and colours. Each print derives its randomness from a corresponding hash constraining the infinite possibilities for each print in the edition to a single unique image. The series invites the observer to lose themselves in a selection of maps and annotated photographs from the unorganized archives that loosely chronicle the travels of a stranger in a mythical land.
,beginShape(),icmp=-1;icmp<2;icmp+=2)for(jcmp=-1;jcmp<2;jcmp+=2)beginShape(),vertex(icmp*n4*CR,jcmp*n4*CR),vertex(icmp*n3*CR,jcmp*n2*CR),vertex(icmp*n2*CR,jcmp*n2*CR),vertex(icmp*n2*CR,jcmp*n3*CR),endShape(CLOSE);noFill(),strokeWeight(1.5*M),arc(0,0,r*CR,r*CR,-.89*HALF_PI,.97*TAU),arc(0,0,r*CR,r*CR,-.97*TAU,.89*HALF_PI),arc(0,0,r*CR,r*CR,1.055*PI,2.895*HALF_PI),arc(0,0,r*CR,r*CR,-2.895*HALF_PI,-1.0556*PI),pop()}function plotscale(dx,dy,CR){for(push(),translate(dx,dy),stroke(sclcol),jj=0;jj<5;jj++)jj%2==1?fill(sclcol):fill(1,.73),rect(20*jj*M,0,20*M,5*M);pop()}function FindMinMax(Val){for(MnnC=1e9,MxxC=1e-9,ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)Val[ix][iy]<MnnC&&(MnnC=Val[ix][iy]),Val[ix][iy]>MxxC&&(MxxC=Val[ix][iy])}function FindMinMaxCities(){for(MxxCities=1e-9,MxxCities2=1e-9,ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)CLgts[ix][iy]>MxxCities&&(MxxCities=CLgts[ix][iy]),CLgts2[ix][iy]>MxxCities2&&(MxxCities2=CLgts2[ix][iy])}function createPaper(){Paper=createGraphics(Qfull,Qfull),ht=.1,st=.075,vt=.8,at=.2,at2=.2,Paper.colorMode(HSB,1),Paper.fill(ConCol3),4==MAPTYPE&&Paper.fill(ConCol),6==MAPTYPE&&Paper.fill(ConCol2),Paper.noStroke(),Paper.square(0,0,Qfull),createTexture(),createFibers(),6!=MAPTYPE&&Paper.square(xstart,ystart,Q)}function ScaleHeights(){for(ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)H[ix][iy]=hsm*H[ix][iy]+1.1*hsb-hsb*fas*famap[ix][iy]}function Normaliseheights(){for(ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)H[ix][iy]=(H[ix][iy]-Mnn)/(Mxx-Mnn)}function ScaleHeightsIsland(){for(ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)H[ix][iy]=hsb+hsm*H[ix][iy]-fas*famap[ix][iy]}function plotborders(){for(Borderimage=createGraphics(Q,Q),Borderimage.colorMode(HSB,1),1==MAPTYPE||2==MAPTYPE||3==MAPTYPE?Borderimage.stroke(0,1):Borderimage.stroke(0),Borderimage.strokeWeight(1*M),i=0;i<IX.length;i++)H[round(IX[i])][round(IY[i])]>0&&Borderimage.point(IX[i],IY[i])}function FindMinMaxMeanCentre(Val){for(CNTL=0,CNTS=0,Mnn=1e9,Mxx=1e-9,MNLH=0,MNSH=0,ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)Val[ix][iy]<Mnn&&(Mnn=Val[ix][iy]),Val[ix][iy]>Mxx&&(Mxx=Val[ix][iy]),Val[ix][iy]>0&&(MNLH+=Val[ix][iy],CNTL++),Val[ix][iy]<0&&(MNSH+=Val[ix][iy],CNTS++)}function CheckForLand(Val){for(MXLD=-1e9,ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)Val[ix][iy]>MXLD&&(MXLD=Val[ix][iy])}function RS(){return RN.RNc([-1,1])}
<GTh*Mxx&&(Mcraft.fill(.4,130/255,56/255),Mcraft.rect(ix,iy,dtt)),H[dix][diyy]>GTh*Mxx&&H[dix][diyy]<GMTh*Mxx&&(Mcraft.fill(105/255,76/255,47/255),Mcraft.rect(ix,iy,dtt)),H[dix][diyy]>GMTh*Mxx&&H[dix][diyy]<Mxx&&(Mcraft.fill(90/255,90/255,86/255),Mcraft.rect(ix,iy,dtt)),H[dix][diyy]<=0&&(Mcraft.fill(7/255,37/255,107/255),Mcraft.rect(ix,iy,dtt));for(Mcraft.noStroke(),ix=0;ix<Q-1;ix++)for(iy=0;iy<Q-1;iy++)BTh=.1,GTh=.33,GMTh=.5,DSSS=-.1,H[ix][iy]>0*Mxx&&H[ix][iy]<BTh*Mxx&&CLgts[ix][iy]/MxxCities>1.1*CLgts2[ix][iy]/MxxCities2&&(Mcraft.fill(173/255-DSSS,164/255-DSSS,112/255-DSSS),Mcraft.rect(ix,iy,1,1)),H[ix][iy]>BTh*Mxx&&H[ix][iy]<GTh*Mxx&&CLgts[ix][iy]/MxxCities>1*CLgts2[ix][iy]/MxxCities2&&(Mcraft.fill(43/255,74/255,7/255),Mcraft.rect(ix,iy,1,1)),H[ix][iy]>GTh*Mxx&&H[ix][iy]<GMTh*Mxx&&CLgts[ix][iy]/MxxCities>1.3*CLgts2[ix][iy]/MxxCities2&&(Mcraft.fill(75/255,56/255,37/255),Mcraft.rect(ix,iy,1,1)),H[ix][iy]>GMTh*Mxx&&H[ix][iy]<Mxx&&CLgts[ix][iy]/MxxCities>1.2*CLgts2[ix][iy]/MxxCities2&&(Mcraft.fill(70/255,70/255,76/255),Mcraft.rect(ix,iy,1,1));if(1==MCGRID)for(Mcraft.stroke(0),Mcraft.strokeWeight(.1*M),ix=0;ix<Q-dtt;ix+=dtt)for(iy=0;iy<Q-dtt;iy+=dtt)Mcraft.fill(0,0),Mcraft.rect(ix,iy,dtt)}function CreateBorders(){PolMap=createGraphics(width,height),pc=[],nx=[],ny=[],Npop=[],Cll=[],IX=[],nc2=[],IY=[],PolMap.colorMode(HSB,1),placeCities();for(let j=0;j<Q;j++)Cll[j]=[];for(PolMap.noStroke(),ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++){for(pc[ix*Q+iy]=-1,ci=0,cd=1e4,ld=cd,dx=ix+PoliticalMessiness/xs*(Perlin(ix/35*xs,iy/35*xs)-.5)*45,dy=iy+PoliticalMessiness/xs*(Perlin(ix*xs/35+1,iy/35*xs)-.5)*45,i=0;i<Ncount;i++)nd=sqrt(sq(dx-nx[i])+sq(dy-ny[i])),nd<cd?(ld=cd,cd=nd,ci=i):nd<ld&&(ld=nd);Cll[ix][iy]=ci,1!=MAPTYPE&&2!=MAPTYPE||(H[ix][iy]>0&&(PolMap.fill(nc2[Cll[ix][iy]],.3+0*H[ix][iy],.95+.15*H[ix][iy],.8),PolMap.rect(ix,iy,1,1)),H[ix][iy]<=0&&(PolMap.fill(.52,.2,1+5e-4*H[ix][iy],.85),PolMap.rect(ix,iy,1,1)))}for(ix=0;ix<Q-1;ix++)for(iy=0;iy<Q-1;iy++)(abs(Cll[ix][iy]-Cll[ix+1][iy])>0||abs(Cll[ix][iy]-Cll[ix][iy+1])>0)&&(IX.push(ix),IY.push(iy))}function placeCities(){for(SeachingForCityPosition=1,i=0;i<Ncount;i++)nx[i]=floor((i+.15+RN.RNd(.7))%sqrt(Ncount)/sqrt(Ncount)*Q),ny[i]=floor((floor(i/sqrt(Ncount))+.15+RN.RNd(.7))/sqrt(Ncount)*Q),Ncount<6?(Ncount,nc2[i]=i/Ncount+.16):nc2[i]=i/Ncount,1==Ncount&&(nc2[0]=RN.RNc([RN.RNn(0,.4),RN.RNn(.75,1)]))}function GenShadowMap(){QSS=round(Q/(1*M)),xs=1,SHP=[];for(let j=0;j<QSS;j++)SHP[j]=[];for(Shadow=createGraphics(QSS,QSS),Shadow.colorMode(HSB,1),ix=0;ix<QSS;ix++)for(iy=0;iy<QSS;iy++)st1=8*Perlin((ix+xspeed*Tme)/400*xs*P2,(iy+yspeed*Tme)/400*xs*P2,Tme),dst1=Perlin((ix+xspeed*Tme)/40*xs*P2,(iy+yspeed*Tme)/40*xs*P2,Tme),nss1=Perlin((ix+xspeed*Tme)/100*xs*P2,(iy+yspeed*Tme)/100*xs*P2,st1+dst1,Tme),st2=8*Perlin((ix+xspeed*Tme)/800*xs*P2,(iy+yspeed*Tme)/800*xs*P2,Tme),dst2=Perlin((ix+xspeed*Tme)/80*xs*P2,(iy+yspeed*Tme)/80*xs*P2,Tme),nss2=1.5*Perlin((ix+xspeed*Tme)/200*xs*P2,(iy+yspeed*Tme)/200*xs*P2,st2+dst2,Tme),rgh=Perlin((ix+xspeed*Tme)/600*xs*P2,(iy+yspeed*Tme)/600*xs*P2,Tme)-.3,bpd=Perlin((ix+xspeed*Tme)/20*xs*P2,(iy+yspeed*Tme)/20*xs*P2,Tme),bmp=Perlin((ix+xspeed*Tme)/50*xs*P2,(iy+yspeed*Tme)/50*xs*P2,2*bpd,Tme),SHP[ix][iy]=nss1+sq(sq(nss2))+rgh*bmp-.8,SHP[ix][iy]=SHP[ix][iy]/.5,Shadow.fill(ConCol3[0],ConCol3[1],.9*SHP[ix][iy],.6*SHP[ix][iy]),Shadow.noStroke(),Shadow.rect(ix,iy,1,1)}function LSB(){SBI=createGraphics(Q,Q),SBI.colorMode(HSB,1),SBI2=createGraphics(Q,Q),SBI2.colorMode(HSB,1),SBI3=createGraphics(Q,Q),SBI3.colorMode(HSB,1),SBI4=createGraphics(Q,Q),SBI4.colorMode(HSB,1),SB=[];for(let j=0;j<Q;j++)SB[j]=[];for(ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)H[ix][iy]>0?SB[ix][iy]=1:SB[ix][iy]=0;for(SBI.stroke(1,1,0),SBI.strokeWeight(1.75*M),SBX=[],SBY=[],ix=0;ix<Q-1;ix++)for(iy=0;iy<Q;iy++)4==MAPTYPE&&(H[ix][iy]>0?SBI.fill(.3,.3,1):SBI.fill(.6,.3,1),SBI.noStroke(),H[ix][iy]>.33*Mxx&&SBI.stroke(ConCol),SBI.rect(ix,iy,1,1)),(abs(SB[ix][iy]-SB[ix+1][iy])>0||abs(SB[ix][iy]-SB[ix][iy+1])>0)&&(SBX.push(ix),SBY.push(iy));for(i in SBI3.strokeWeight(1*M),SBI4.strokeWeight(1*M),SBI2.strokeWeight(1.75*M),SBI3.stroke(0),SBI4.stroke(0,.5),SBI2.stroke(.6,1,.6),(1==MAPTYPE||2==MAPTYPE||3==MAPTYPE)&&SBI4.stroke(0,1),SBX)SBI3.point(SBX[i],SBY[i]),SBI4.point(SBX[i],SBY[i]),SBI2.point(SBX[i],SBY[i])}function CreateBorder(){if(MapBorder=createGraphics(Qfull,Qfull),MapBorder.colorMode(HSB,1),MapBorder.noFill(),MapBorder.stroke(0),MapBorder.strokeWeight(1*M),dn=-0*M,MapBorder.square(xstart+dn,ystart+dn,Q-2*dn),dn=-2*M,MapBorder.square(xstart+dn,ystart+dn,Q-2*dn),dn=-10*M,MapBorder.square(xstart+dn,ystart+dn,Q-2*dn),OBD=35,dn=-OBD*M,MapBorder.square(xstart+dn,ystart+dn,Q-2*dn),dn=-(OBD+5)*M,MapBorder.strokeWeight(2*M),MapBorder.square(xstart+dn,ystart+dn,Q-2*dn),dn=-(OBD+10)*M,MapBorder.strokeWeight(2*M),MapBorder.square(xstart+dn,ystart+dn,Q-2*dn),MapBorder.textSize(width/30),"Island"==fn&&(DC=RN.RNc([.1,.2])),"MainLandCoast"==fn&&(DC=RN.RNc([.5,1])),"Island Chain"==fn&&(DC=RN.RNc([.25,.5])),"Landlocked"==fn&&(DC=RN.RNc([.5,1])),"SparseIslands"==fn&&(DC=RN.RNc([.1,.2])),4==MAPTYPE&&(DC=RN.RNc([.1])),RC1=RN.RNd(),RC2=RN.RNd(),DIN=RN.RNi(0,70),DIW=RN.RNi(0,70),5!=MAPTYPE&&7!=MAPTYPE&&8!=MAPTYPE&&9!=MAPTYPE)for(i=0;i<11;i++)MapBorder.strokeWeight(1*M),MapBorder.noStroke(),MapBorder.fill(0),MapBorder.textSize(width/80),MapBorder.textAlign(CENTER,CENTER),60==MAPTYPE&&(MapBorder.text(RndN(DIW+i*DC,1),Qfull/12+Qfull*i/12,.93*Qfull),MapBorder.text(RndN(DIW+i*DC,1),Qfull/12+Qfull*i/12,.07*Qfull),MapBorder.text(RndN(DIN+(10-i)*DC,1),.07*Qfull,Qfull/12+Qfull*i/12),MapBorder.text(RndN(DIN+(10-i)*DC,1),.93*Qfull,Qfull/12+Qfull*i/12)),MapBorder.strokeWeight(.5*M),1==MAPTYPE?MapBorder.stroke(0):MapBorder.stroke(.5),MapBorder.line(Qfull/12+Qfull*i/12,.913*Qfull,Qfull/12+Qfull*i/12,.0873*Qfull),MapBorder.line(.0873*Qfull,Qfull/12+Qfull*i/12,.913*Qfull,Qfull/12+Qfull*i/12)}function CreateRegionNames(){lang=makeRandomLanguage(),FNt=RN.RNc(["Serif","Courier New","Segoe script"]),FNt="Serif",MAPTYPE==6?FNt="Serif":0,Regions=createGraphics(Q,Q),Regions.textFont(FNt),FindMinMax(Cll),BR=landBright/landPixel,NAMESPACE=[];for(let j=0;j<Q;j++)NAMESPACE[j]=[];for(iC=0;iC<=MxxC;iC++){for(sx=0,sy=0,sc=0,ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)0==iC&&(NAMESPACE[ix][iy]=0),Cll[ix][iy]==iC&&H[ix][iy]>=0&&(sx+=ix,sy+=iy,sc+=1);if(Regions.colorMode(HSB,1),(1==MAPTYPE||5==MAPTYPE)&&(BR<5?(Regions.stroke(0),Regions.strokeWeight(2*M),Regions.fill(1)):(Regions.noStroke(),Regions.strokeWeight(2*M),Regions.fill(0))),1==MAPTYPE&&3==CCol&&(Regions.stroke(1),Regions.strokeWeight(.25*M),Regions.fill(1)),6==MAPTYPE&&(Regions.stroke(ConCol2),Regions.strokeWeight(2*M),Regions.fill(0)),Reg=capitalize(makeName(lang,"Region")),LAN1=lang.structure,Regions.textSize(21*M),"Rockwell"!=FNt?Regions.textStyle(BOLD):Regions.textStyle(NORMAL),Regions.textAlign(CENTER,CENTER),xcn=sx/sc,ycn=sy/sc,!(xcn<.07*Q||xcn>.93*Q||ycn>.95*Q||ycn<.05*Q)){for(ddx=115*M,ddy=20*M,XZZ=0,xst=round(xcn-ddx),xen=round(xcn+ddx),yst=round(ycn-ddy),yen=round(ycn+ddy),xst<0&&(xst=0),xen>Q-1&&(xen=Q-1),yst<0&&(yst=0),yen>Q-1&&(yen=Q-1),nrx=xst;nrx<xen;nrx++){for(nry=yst;nry<yen;nry++)1!=NAMESPACE[nrx][nry]||(XZZ=1);XZZ}if(1!=XZZ){for(nrx=xst;nrx<xen;nrx++)for(nry=yst;nry<yen;nry++)NAMESPACE[nrx][nry]=1;Regions.text(Reg,xcn,ycn)}}}for(i in TH=.5,ddx=85*M,ddy=13*M,"Island"==fn&&(TH=.25),"MainLandCoast"==fn&&(TH=.025),"Island Chain"==fn&&(TH=0),"Landlocked"==fn&&(TH=.5),"SparseIslands"==fn&&(TH=0),PDS(TH,100),PX2=[],PY2=[],PX)PX2[i]=(Q-1)*(PX[i]-min(PX))/(max(PX)-min(PX)),PY2[i]=(Q-1)*(PY[i]-min(PY))/(max(PY)-min(PY));for(k in RNDNUMS(),DC=RN.RNn(1,2),PX2)if(i=ranNums[k],ixr=round(PX2[i]),iyr=round(PY2[i]),City=capitalize(makeName(lang,"city")),LAN2=lang.structure,6!=MAPTYPE?MTHr=.6:MTHr=.34,XZZ=0,xst=round(ixr-ddx),xen=round(ixr+ddx),yst=round(iyr-ddy+6*M*1.5),yen=round(iyr+ddy+6*M*1.5),H[ixr][iyr]>=0.05*Mxx&&H[ixr][iyr]<Mxx*MTHr){if(xst<0||xen>Q-1||yst<0||yen>Q-1)continue;for(nrx=xst;nrx<xen;nrx++){for(nry=yst;nry<yen;nry++)1!=NAMESPACE[nrx][nry]||(XZZ=1);XZZ}if(1==XZZ)continue;if(ixr<.07*Q||ixr>.93*Q||iyr>.95*Q||iyr<.05*Q)continue;for(nrx=xst;nrx<xen;nrx++)for(nry=yst;nry<yen;nry++)NAMESPACE[nrx][nry]=1;Regions.stroke(0),Regions.fill(0),Regions.strokeWeight(1*M),2==MAPTYPE&&(Regions.stroke(0),Regions.fill(1)),4==MAPTYPE&&(Regions.stroke(0),Regions.fill(1)),6!=MAPTYPE?(Regions.fill(ConCol),CTSC=.75):(Regions.fill(0),CTSC=.68),Regions.ellipse(ixr,iyr-4*M,CTSC*M*6),(1==MAPTYPE||5==MAPTYPE)&&(BR<5?(Regions.stroke(0),Regions.strokeWeight(3*M),Regions.fill(ConCol)):(Regions.noStroke(),Regions.strokeWeight(3*M),Regions.fill(0))),6==MAPTYPE&&(Regions.stroke(ConCol2),Regions.strokeWeight(2*M),Regions.fill(0),Regions.textStyle(BOLDITALIC)),Regions.textSize(16*M),Regions.text(City,ixr,iyr+6*M*1.5)}function RNDNUMS(){for(i in nums=[],PX2)nums[i]=i;for(ranNums=[],i=nums.length,j=0;i--;)j=Math.floor(RN.RNd()*(i+1)),ranNums.push(nums[j]),nums.splice(j,1)}}function PDS(TH,Rad){k=30,grid=[],wss=Rad/1.4,active=[],ordered=[],Y=1e3,cols=floor(Y/wss),rows=floor(Y/wss);for(var o=0;o<cols*rows;o++)grid[o]=void 0;var e=Y/2,d=Y/2,t=(o=floor(e/wss),floor(d/wss)),i=createVector(e,d);grid[o+t*cols]=i,active.push(i);for(var a=0;a<1e3;a++)if(active.length>0){for(var s=floor(RN.RNn(0,active.length)),c=(i=active[s],!1),l=0;l<k;l++){var f=createVector(RN.RNn(-500,500),RN.RNn(-500,500)),v=RN.RNn(Rad,2*Rad);f.setMag(v),f.add(i);var g=floor(f.x/wss),h=floor(f.y/wss);if(g>-1&&h>-1&&g<cols&&h<rows&&!grid[g+h*cols]){var n=!0;for(o=-1;o<=1;o++)for(t=-1;t<=1;t++){var p=grid[g+o+(h+t)*cols];p&&p5.Vector.dist(f,p)<Rad&&(n=!1)}if(n){c=!0,grid[g+h*cols]=f,active.push(f),ordered.push(f);break}}}c||active.splice(s,1)}for(PX=[],PY=[],o=0;o<ordered.length;o++)ordered[o]&&RN.RNn(0,1)>TH&&(PX.push(ordered[o].x),PY.push(ordered[o].y));return PX,PY}function plotcoCRpass(dx,dy,CR){for(n=.15,n2=.22,n3=.29,n4=.45,r=1.6,fill(sclcol),stroke(sclcol),strokeWeight(0),push(),translate(dx,dy),textFont("Serif"),textSize(10*M),textStyle(BOLD),textAlign(CENTER,CENTER),text("N",0,-1.26*CR),beginShape(),vertex(-CR,0),vertex(-n*CR,n*CR),vertex(0,CR),vertex(n*CR,n*CR),vertex(CR,0),vertex(n*CR,-n*CR),vertex(0,-CR),vertex(-n*CR,-n*CR),endShape(CLOSE)
ill(nc),landBright+=brightness(nc),landPixel++):(nc=color(SHUE,SSAT,.739+max(-.178,2*H[ix][iy])+.261*H[ix][iy]),nc=lerpColor(nc,color(Hd[ix][iy]>0?SEAROUGHNESS:0),sqrt(abs(Hd[ix][iy]))),GeoMap.fill(nc),H[ix][iy]=200*H[ix][iy]),GeoMap.rect(ix,iy,1,1)}function GenerateFalloffMap(){famap=[];for(let j=0;j<Q;j++)famap[j]=[];for(i=0;i<Q;i++)for(j=0;j<Q;j++)xf=i/Q*2-1,yf=j/Q*2-1,hfa=Math.max(Math.abs(xf+dxf/Q*2),Math.abs(yf+dyf/Q*2)),famap[i][j]=Evalfa(hfa);return famap}function Evalfa(hfa){return Math.pow(hfa,af)/(Math.pow(hfa,af)+Math.pow(bf-bf*hfa,af))}function keyTyped(){"s"==key&&saveCanvas(join([tokenData.hash,tokenData.tokenId],"__"),"png"),32==keyCode&&noLoop(),"c"==key&&loop()}function NightMode(){for(NM=createGraphics(Q,Q),NM.colorMode(HSB,1),NM.noStroke(),NM.fill(240/360,.63,.09),NM.rect(0,0,Q,Q),ix=0;ix<Q;ix++)for(iy=0;iy<Q;iy++)H[ix][iy]>0&&(NM.fill(247/360,.5,.12+.3*H[ix][iy]/Mxx),NM.rect(ix,iy,1,1));for(CTTHR=RN.RNn(.86,.886),CTTHR2=.92,CTTHR3=.33,CTTHR4=1,FindMinMaxCities(),xlgts=[],ylgts=[],Nlights=RN.RNi(2e4,4e4),ilights=0;ilights<Nlights;ilights++)xlgts[ilights]=(Q-1)*RN.RNn(0,1),ylgts[ilights]=(Q-1)*RN.RNn(0,1);for(xlgts2=[],ylgts2=[],Nlights2=RN.RNi(5e3,2.1e4),ilights2=0;ilights2<Nlights2;ilights2++)xlgts2[ilights2]=(Q-1)*RN.RNn(0,1),ylgts2[ilights2]=(Q-1)*RN.RNn(0,1);for(ix=0;ix<Q;ix+=1)for(iy=0;iy<Q;iy+=1)ilights++,CLgts[ix][iy]/MxxCities>CTTHR&&CLgts[ix][iy]/MxxCities>1.5*CLgts2[ix][iy]/MxxCities2&&(xlgts[ilights]=ix,ylgts[ilights]=iy);for(ilights in 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),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),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),NM2.point(ix,iy))}function SECSH(dxmount,dymount,MSC,LSCS){for(rnnn=[],iiit=0;iiit<14;iiit++)rnnn[iiit]=MSC*M*RN.RNn(-.3,.3);push(),translate(dxmount+dQ,dymount+dQ),beginShape(),WW=MSC*M,W2=.5,curveVertex(-WW+WW*rnnn[0],WW*W2+rnnn[1]),curveVertex(0+WW*rnnn[2],0+rnnn[3]),curveVertex(WW+WW*rnnn[4],WW*W2+rnnn[5]),curveVertex(2*WW+WW*rnnn[6],0+rnnn[7]),curveVertex(3*WW+WW*rnnn[8],WW*W2+rnnn[9]),curveVertex(4*WW+WW*rnnn[10],0+rnnn[11]),curveVertex(5*WW+WW*rnnn[12],WW*W2+rnnn[13]),endShape(),pop()}function Grass(dxmount,dymount,MSC,LSCS){for(push(),translate(dxmount+dQ,dymount+dQ),ig=1;ig<4;ig++)line(ig*MSC*M+RN.RNn(-.3,.3)*MSC*M,0+RN.RNn(-.3,.3)*MSC*M,(ig-1)*MSC*M+RN.RNn(-.3,.3)*MSC*M,2.5*MSC*M+RN.RNn(-.3,.3)*MSC*M);pop()}function LSCSH(dxmount,dymount,MSC,LSCS){for(rnnn=[],iiit=0;iiit<6;iiit++)rnnn[iiit]=MSC*M*RN.RNn(-.3,.3);push(),translate(dxmount+dQ,dymount+dQ),beginShape(),1==LSCS?(vertex(0+rnnn[0],3*MSC*M+rnnn[1]),vertex(1.5*MSC*M+rnnn[2],0+rnnn[3]),vertex(3*MSC*M+rnnn[4],3*MSC*M+rnnn[5])):line(0,0,3*MSC*M,H[dix+dtt-1][diyy]>=0?10*MSC*M/Mxx*(H[dix][diyy]-H[dix+dtt-1][diyy]):0),endShape(CLOSE),pop()}function createTexture(){const ND=400;RN=new Random;for(let i=0;i<ND;i++)rrx=RN.RNd()*width,rry=RN.RNd()*height,rrr1=M*RN.RNn(1,3),rrr2=M*RN.RNn(1,3),Paper.fill(ht,st,vt,at),Paper.stroke(ht,st,vt,at),Paper.ellipse(rrx,rry,rrr1,rrr2)}function createFibers(){Nf=1e4;let RN=new Random;for(i=0;i<Nf;i++)x1=RN.RNd()*width,y1=RN.RNd()*height,th=2*RN.RNd()*Math.PI,SL=(5*RN.RNd()+2)*pow(Globalw/2,2)/3,x2=cos(th)*SL+x1,y2=sin(th)*SL+y1,Paper.stroke(ht,st-.05*RN.RNd(),vt-.08*RN.RNd(),at2*(.1*RN.RNd()+.75)),Paper.line(x1,y1,x2,y2)}function RndN(Np,n){return round(Np*pow(10,n))/pow(10,n)}function shuffled(list){for(var newlist=[],i=0;i<list.length;i++)newlist.push(list[i]);for(var i=list.length-1;i>0;i--){var tmp=newlist[i],j=randrange(i);newlist[i]=newlist[j],newlist[j]=tmp}return newlist}function choose(list,exponent){return exponent=exponent||1,list[Math.floor(Math.pow(RN.RNd(),exponent)*list.length)]}function randrange(lo,hi){return null==hi&&(hi=lo,lo=0),Math.floor(RN.RNd()*(hi-lo))+lo}function join(list,sep){if(0==list.length)return"";sep=sep||"";for(var s=list[0],i=1;i<list.length;i++)s+=sep,s+=list[i];return s}function capitalize(word){return word[0].toUpperCase()+word.slice(1)}function spell(lang,syll){if(lang.noortho)return syll;for(var s="",i=0;i<syll.length;i++){var c=syll[i];s+=lang.cortho[c]||lang.vortho[c]||defaultOrtho[c]||c}return s}function makeSyllable(lang){for(;;){for(var syll="",i=0;i<lang.structure.length;i++){var ptype=lang.structure[i];"?"==lang.structure[i+1]&&(i++,RN.RNd()<.5)||(syll+=choose(lang.phonemes[ptype],lang.exponent))}for(var bad=!1,i=0;i<lang.restricts.length;i++)if(lang.restricts[i].test(syll)){bad=!0;break}if(!bad)return spell(lang,syll)}}function getMorpheme(lang,key){if(lang.nomorph)return makeSyllable(lang);key=key||"";var list=lang.morphemes[key]||[],extras=10;for(key&&(extras=1);;){var n=randrange(list.length+extras);if(list[n])return list[n];var morph=makeSyllable(lang),bad=!1;for(var k in lang.morphemes)if(lang.morphemes[k].includes(morph)){bad=!0;break}if(!bad)return list.push(morph),lang.morphemes[key]=list,morph}}function makeWord(lang,key){var nsylls=randrange(lang.minsyll,lang.maxsyll+1),w="",keys=[];keys[randrange(nsylls)]=key;for(var i=0;i<nsylls;i++)w+=getMorpheme(lang,keys[i]);return w}function getWord(lang,key){key=key||"";var ws=lang.words[key]||[],extras=3;for(key&&(extras=2);;){var n,w=ws[randrange(ws.length+extras)];if(w)return w;w=makeWord(lang,key);var bad=!1;for(var k in lang.words)if(lang.words[k].includes(w)){bad=!0;break}if(!bad)return ws.push(w),lang.words[key]=ws,w}}function makeName(lang,key){for(key=key||"",lang.genitive=lang.genitive||getMorpheme(lang,"of"),lang.definite=lang.definite||getMorpheme(lang,"the");;){var name=null;if(RN.RNd()<.5)name=capitalize(getWord(lang,key));else{var w1=capitalize(getWord(lang,RN.RNd()<.6?key:"")),w2=capitalize(getWord(lang,RN.RNd()<.6?key:""));if(w1==w2)continue;name=RN.RNd()>.5?join([w1,w2],lang.joiner):join([w1,lang.genitive,w2],lang.joiner)}if(RN.RNd()<.1&&(name=join([lang.definite,name],lang.joiner)),!(name.length<lang.minchar||name.length>lang.maxchar)){for(var used=!1,i=0;i<lang.names.length;i++){var name2=lang.names[i];if(-1!=name.indexOf(name2)||-1!=name2.indexOf(name)){used=!0;break}}if(!used)return lang.names.push(name),name}}}function makeBasicLanguage(){return{phonemes:{C:"ptkmnls",V:"aeiou",S:"s",F:"mn",L:"rl"},structure:"CVC",exponent:2,restricts:[],cortho:{},vortho:{},noortho:!0,nomorph:!0,nowordpool:!0,minsyll:1,maxsyll:1,morphemes:{},words:{},names:[],joiner:" ",maxchar:12,minchar:5}}function makeOrthoLanguage(){var lang=makeBasicLanguage();return lang.noortho=!1,lang}function makeRandomLanguage(){var lang=makeBasicLanguage();return lang.noortho=!1,lang.nomorph=!1,lang.nowordpool=!1,lang.phonemes.C=shuffled(choose(consets,2).C),lang.phonemes.V=shuffled(choose(vowsets,2).V),lang.phonemes.L=shuffled(choose(lsets,2).L),lang.phonemes.S=shuffled(choose(ssets,2).S),lang.phonemes.F=shuffled(choose(fsets,2).F),lang.structure=choose(syllstructs),lang.restricts=ressets[2].res,lang.cortho=choose(corthsets,2).orth,lang.vortho=choose(vorthsets,2).orth,lang.minsyll=randrange(1,3),lang.structure.length<3&&lang.minsyll++,lang.maxsyll=randrange(lang.minsyll+1,7),lang.joiner=choose(" -"),lang}var defaultOrtho={"ʃ":"sh","ʒ":"zh","ʧ":"ch","ʤ":"j","ŋ":"ng",j:"y",x:"kh","ɣ":"gh","ʔ":"‘",A:"á",E:"é",I:"í",O:"ó",U:"ú"},corthsets=[{name:"Default",orth:{}},{name:"Slavic",orth:{"ʃ":"š","ʒ":"ž","ʧ":"č","ʤ":"ǧ",j:"j"}},{name:"German",orth:{"ʃ":"sch","ʒ":"zh","ʧ":"tsch","ʤ":"dz",j:"j",x:"ch"}},{name:"French",orth:{"ʃ":"ch","ʒ":"j","ʧ":"tch","ʤ":"dj",x:"kh"}},{name:"Chinese (pinyin)",orth:{"ʃ":"x","ʧ":"q","ʤ":"j"}}],vorthsets=[{name:"Ácutes",orth:{}},{name:"Ümlauts",orth:{A:"ä",E:"ë",I:"ï",O:"ö",U:"ü"}},{name:"Welsh",orth:{A:"â",E:"ê",I:"y",O:"ô",U:"w"}},{name:"Diphthongs",orth:{A:"au",E:"ei",I:"ie",O:"ou",U:"oo"}},{name:"Doubles",orth:{A:"aa",E:"ee",I:"ii",O:"oo",U:"uu"}}],consets=[{name:"Minimal",C:"ptkmnls"},{name:"English-ish",C:"ptkbdgmnlrsʃzʒʧ"},{name:"Pirahã (very simple)",C:"ptkmnh"},{name:"Hawaiian-ish",C:"hklmnpwʔ"},{name:"Greenlandic-ish",C:"ptkqvsgrmnŋlj"},{name:"Arabic-ish",C:"tksʃdbqɣxmnlrwj"},{name:"Arabic-lite",C:"tkdgmnsʃ"},{name:"English-lite",C:"ptkbdgmnszʒʧhjw"}],ssets=[{name:"Just s",S:"s"},{name:"s ʃ",S:"sʃ"},{name:"s ʃ f",S:"sʃf"}],lsets=[{name:"r l",L:"rl"},{name:"Just r",L:"r"},{name:"Just l",L:"l"},{name:"w j",L:"wj"},{name:"r l w j",L:"rlwj"}],fsets=[{name:"m n",F:"mn"},{name:"s k",F:"sk"},{name:"m n ŋ",F:"mnŋ"},{name:"s ʃ z ʒ",F:"sʃzʒ"}],vowsets=[{name:"Standard 5-vowel",V:"aeiou"},{name:"3-vowel a i u",V:"aiu"},{name:"Extra A E I",V:"aeiouAEI"},{name:"Extra U",V:"aeiouU"},{name:"5-vowel a i u A I",V:"aiuAI"},{name:"3-vowel e o u",V:"eou"},{name:"Extra A O U",V:"aeiouAOU"}],syllstructs=["CVC","CVV?C","CVVC?","CVC?","CV","VC","CVF","C?VC","CVF?","CL?VC","CL?VF","S?CVC","S?CVF","S?CVC?","C?VF","C?VC?","C?VF?","C?L?VC","VC","CVL?C?","C?VL?C","C?VLC?"],ressets=[{name:"None",res:[]},{name:"Double sounds",res:[/(.)\1/]},{name:"Doubles and hard clusters",res:[/[sʃf][sʃ]/,/(.)\1/,/[rl][rl]/]}];function MineCraft(){for(FindMinMaxCities(),Mcraft=createGraphics(Q,Q),Mcraft.colorMode(RGB,1),Mcraft.noStroke(),Mcraft.fill(7/255,37/255,107/255),Mcraft.rect(0,0,Q,Q),dtt1=RN.RNi(4,7),dtt1=8,dtt=round(dtt1*M),dtt<3*M&&(MCGRID=0),MCGRID=1,Mcraft.stroke(0),Mcraft.strokeWeight(.1*M),1!=MCGRID&&Mcraft.noStroke(),BTh=RN.RNn(.01,.05),"Landlocked"==fn&&(BTh=.001),"MainLandCoast"==fn&&(BTh=.001),BTh=0,GTh=.33,GMTh=.5,ix=0;ix<Q-dtt;ix+=dtt)for(iy=0;iy<Q-dtt;iy+=dtt)dix=round(ix+dtt/2),diyy=round(iy+dtt/2),H[dix][diyy]>0&&H[dix][diyy]<BTh*Mxx&&(Mcraft.fill(173/255,164/255,112/255),Mcraft.rect(ix,iy,dtt)),H[dix][diyy]>BTh*Mxx&&H[dix][diyy]
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,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