0xf8d9056d…5d46sent to0x4e171e0f…8429·#15,909,201·view on Etherscan
console.log("########################### WELCOME TO CHAINLIFE! ############################"),console.log(""),console.log("THIS TOKEN'S SCRIPT INPUTS ARE..."),console.log(`TOKEN ID: ${scriptInputs.token_id}`),console.log(`TOKEN ENTROPY: ${scriptInputs.token_entropy}`),console.log(`PREVIOUS OWNER: ${scriptInputs.previous_owner}`),console.log(`CURRENT OWNER: ${scriptInputs.current_owner}`),console.log(`TRANSFER COUNT: ${scriptInputs.transfer_count}`),console.log(`LEVEL SHIFT: ${scriptInputs.level_shift}`),console.log(`CUSTOM RULE: ${scriptInputs.custom_rule}`),console.log(""),console.log("##################################################################################"),console.log("");let gridS,w,hW,p,bkg,pal,jLineCol,rset,alive,died,ruMem,vB,input,button,previewBin,previewSeed,canvas,count=0,rad=0,repopC=0,score=0,born=0,htmlCol=0,lLim=9999,tLit=Math.floor(lLim/23.8),rec=!1,clicked=!1,showCyc=!1,logged=!1,zoom=!1,bil=!1,step=!1,flipU=!1,inv=!1,pro=!1,repopU=!1,repop=!1,matured=!1,joy=!1,ghost=!1,shifting=!1,game=!0,endLog=!1,showHelp=!1,showNcount=!1,preview=!1,customRulePrev=!1,customRuleOn=!1,expa=!1,OG=!1,showoff=!1,grad=!1,zenMint=!1,conway=!1,lit=!1,mm=!1,inp="",cyc="",ruLog="",liveMem="",sE=[],log=[],rule=[],rO=[],htmlCols=[],seedSpaced=[],chars=["∨","∧","⊻","↓","↑","⊙"],attributes=[],palStateStr="Base",joyStrings=["Standard","Sparkling","Sphere"],maturityValueStrings=["Not Yet Matured","Unlocked"],maturitySpeedStrings=["Slightly Faster","Normal","Slightly Slower"],cellStyleStrings=["Shifting","Square","Rounded Square","Circle","Diamond","Horizontal","Vertical","Triangle","X","Ellipses/Arc","Random Quad","Random Lines"],hexPat=/^0[xX]{1}[a-fA-F0-9]{40}$/,rulPat=/^[bB]([0-9]+)?/[sS]([0-9]+)?$/,conPat=/^[Cc](onway|ONWAY)/,tokenEntropyVal=createPairs(scriptInputs.token_entropy),cOwnerBin=createBin(scriptInputs.current_owner),pOwnerBin=createBin(scriptInputs.previous_owner),tCount=parseInt(scriptInputs.transfer_count),lShift=parseInt(scriptInputs.level_shift),level=tCount+lShift,lTri=level%3;level>lLim?level=lLim:level<0&&(level=0);let tID=parseInt(scriptInputs.token_id),idB=tID%2,mode=tCount%6,char=chars[mode];console.log(`Logic gate applied to binaries: ${char}`);let seed=setSeed(cOwnerBin,pOwnerBin),seedBin=createBin(seed),bfr=5*getVal(1,3);5==getVal(1,5)&&(expa=!0,bfr=Math.min(25,16+level)),setGS(),seedSpaced=0==idB?[0,0,0,0].concat(seed,[0,0,0,0,0]):[0,0,0,0,0].concat(seed,[0,0,0,0]),sE.push(seedE(seedSpaced));let state=Array(gridS),next=Array(gridS),minD=Math.min(window.innerWidth,window.innerHeight),canD=minD,cDH=canD/2;setW();let idDelay=tID%3-1;tID<=lastZenMint&&(zenMint=!0),(level>=tLit||tID==tLit)&&(lit=!0),(level>=Math.floor(lLim/10)||tID==Math.floor(lLim/10))&&(mm=!0);let esoTdesc=["Meta","Water","Land","Mountain","Sky"],col=[["#111111","#1b1bb3","#dfdff2","Enso",[0]],["#fcd612","#43AA8B","#275bb2","FOCUS",[0]],["#1f1278","#fb6e49","#c2254b","Sunset",[4]],["#4b0082","#ffd700","#ff6347","Sea Anemone",[1]],["#ffd56c","#f1525d","#058990","Spiny Viper",[2]],["#483d8b","#ff1493","#cce7ff","Parrotfish",[1]],["#92fffe","#a51504","#012c74","San Francisco Garter",[1,2]],["#ff0000","#ffdb00","#331c00","Magma",[1,3]],["#f336bf","#54b5f7","#fcd64c","Mandrill",[2]],["#f8910b","#eeeeee","#111111","Tiger",[2]],["#2d1961","#22ff9f","#17c1ad","Aurora Borealis",[4]],["#ffba03","#d50104","#0690ce","Macaw",[2,4]],["#f62e0c","#f0dfe2","#f5b85e","Koi",[1]],["#d7b2de","#3646d8","#4fa5a2","Lilac Breasted Roller",[2,4]],["#0000ff","#0101A0","#010140","Mariana",[1]],["#007f00","#452e15","#fcfcd3","Alpine",[3,4]],["#00bfff","#fff5ac","#f8f8ff","Partly Cloudy",[4]],["#f0a205","#95610f","#4e2d18","Dog's Eyes",[2]],["#2e398c","#d9def3","#4dab27","Blue Marble",[1,2,3,4]],["#111111","#424242","#eeeeee","Mono",[0]]];if((p=getVal(0,19))>12){let e=100-(p-12)*5;getVal(1,100)>e&&(p=(p-13)*2)}10==p&&level%2==0&&(col[p][1]="#d530b7"),12==p&&level%2==0&&(col[p][1]="#363d47"),htmlCols=["white",col[p][0],col[p][1],col[p][2],"black"];let style=getVal(1,11);if(style>=9){let t=100/(style-7);getVal(1,100)>t&&(style-=5)}let lineCount=1+Math.abs((tCount+8)%16-8);1==getVal(1,5)&&(showoff=!0),1==getVal(1,20)&&p>1&&(grad=!0),tID%10!=0||grad||showoff||(OG=!0);let live=col[p][0],dying=col[p][1],dead=col[p][2];level>=6&&(flipU=!0,palStateStr="Flipping Unlocked"),(1==getVal(1,50)||level>=10)&&(inv=!0,live=col[p][2],dead=col[p][0],palStateStr="Inverted Palette"),level>=14&&(pro=!0,palStateStr="Rotation Unlocked"),level>=16&&(matured=!0),OG&&(dying=dead),1==p?fBKG():bkg=dead,1==style&&(rad=0),2==style&&(rad=.25*w),3==style&&(rad=.5*w),(1==getVal(1,50)||level>2)&&(zoom=!0);let ruLoc=[[.75,.75,0],[.75,1.25,0],[1.25,1.25,0],[1.25,.75,0],[1,1,0]],ru=getVal(1,100);rset=ru>60?0:ru>30?1:ru>10?2:3,rule[0]=["LIFE (B3/S23)",[3],[2,3]],rule[1]=["Day & Night (B3678/S34678)",[3,6,7,8],[3,4,6,7,8]],rule[2]=["Long Life (B345/S5)",[3,4,5],[5]],rule[3]=["Seeds (B2/S)",[2],[]],scriptInputs.custom_rule.match(rulPat)?(formRule(scriptInputs.custom_rule,"Custom Ruleset"),matured&&(rset=4)):scriptInputs.custom_rule="",ruMem=rset,rO.push(0,rset),ruLoc[rset][2]=1;let u1=getVal(1,3)+idDelay,u2=getVal(4,7)+idDelay,u3=getVal(8,10)+idDelay,u4=getVal(11,13)+idDelay;level>u1&&rO.push(1),level>u2&&rO.push(2),level>u3&&(rO.push(3),repopU=!0),level>u4&&(customRulePrev=!0);let joyS=getVal(1,100);joyS<3?(joy=!0,grad=!1):joyS=0;let shiftingV=getVal(1,200);shiftingV<2&&(shifting=!0);let wIn=getVal(1,100);wIn=wIn<2?64:wIn<4?32:wIn<7?16:wIn<11?8:wIn<16?4:wIn<22?2:0;let wRe=getVal(1,100);wRe=wRe<2?64:wRe<4?32:wRe<7?16:wRe<11?8:wRe<16?4:wRe<22?2:0;let esoTen=`${getVal(0,99)}${getVal(0,99)}${getVal(0,99)}${getVal(0,99)}${getVal(0,99)}`,wGC=tID%worldSide,wGR=Math.floor(tID/worldSide);if(0==wGC||63==wGC||0==wGR||63==wGR){console.log("BONUS REACH AND INFLUENCE BONUS! ;)");let l=8;(0==tID||63==tID||4032==tID||4095==tID)&&(l=32),wRe<l&&(wRe=l),wIn<l&&(wIn=l)}addAttri("World Grid Coordinates (→,↓)",`(${wGC},${wGR})`),addAttri("World Grid Column",wGC),addAttri("World Grid Row",wGR),addAttri("World Level",level),addAttri("Community Influence Bonus",`${wIn}`),addAttri("Community Reach Bonus",`${wRe}`),addAttri("Transfer Count",tCount),addAttri("Level Shift",lShift),addAttri("Starting Ruleset",rule[rset][0]),addAttri("Joy",joyStrings[joyS]),addAttri("Logic Gate",char),addAttri("Expanding Habitat",expa),addAttri("Habitat Size",(gridS-2)**2),addAttri("Showoff",showoff),addAttri("Aurora",grad),addAttri("OG",OG),addAttri("Organism Style",shifting?cellStyleStrings[0]:cellStyleStrings[style]),addAttri("Palette",col[p][3]);let esoTlist="";for(let i=0;i<col[p][4].length;i++)esoTlist+=esoTdesc[col[p][4][i]],i<col[p][4].length-1&&(esoTlist+="/");function addAttri(e,t){"boolean"==typeof t&&(t=t.toString()),attributes.push({trait_type:e,value:t})}function evolStrVal(e){return e?maturityValueStrings[1]:maturityValueStrings[0]}function createPairs(e){let t=[];for(let l=0;l<(e.length-2)/2;l++)t.push(parseInt(e.slice(2+2*l,4+2*l),16));return t}function createBin(e){let t="";if(Array.isArray(e))for(let l=0;l<e.length;l++)t+=e[l];else{console.log(`Creating binary from ${e}...`);for(let o=2;o<e.length;o++)t+=parseInt(e[o],16).toString(2).padStart(4,0)}return console.log(`Result: ${t}`),console.log(""),t}function getVal(e,t){t+=.999;let l=Math.floor(tokenEntropyVal[0]*(t-e)/255+e);return tokenEntropyVal.shift(),l}function setSeed(e,t){let l=[];for(let o=0;o<e.length;o++){let r=parseInt(e[o])+parseInt(t[o]);0===mode&&(r>0?l[o]=1:l[o]=0),1===mode&&(2===r?l[o]=1:l[o]=0),2===mode&&(1===r?l[o]=1:l[o]=0),3===mode&&(r>0?l[o]=0:l[o]=1),4===mode&&(2===r?l[o]=0:l[o]=1),5===mode&&(1===r?l[o]=0:l[o]=1)}return l}function seedE(e){let t="";for(let l=0;l<e.length;l++)l>0&&l%13==0&&(t+="$"),"0"==e[l]?t+="b":t+="o";return t+"!"}function upR(e){ruLoc[rset][2]=0,ruLoc[rset=e][2]=1,3!=e&&(ruMem=e),game&&!endLog&&(log.push(""),log.push(`New Rule Set: ${rule[rset][0]}`))}function fBKG(){bkg=tID%2==0?"white":"black"}function formRule(e,t){e=e.toUpperCase();let l,o,r=[],n=[],a="B",d="S";if(l=e.substring(0,e.indexOf("/")),o=e.slice(e.indexOf("/")+1),"B"===l.substring(0,1))for(let s=1;s<l.length;s++){let c=parseInt(l.substring(s,s+1));!1===r.includes(c)&&(r.push(c),a+=c.toString())}if("S"===o.substring(0,1))for(let $=1;$<o.length;$++){let _=parseInt(o.substring($,$+1));!1===n.includes(_)&&(n.push(_),d+=_.toString())}rule[4]=[`${t} (${a}/${d})`,r,n],customRuleOn=!0}function checkInput(){inp=input.value(),input.hide(),button.hide(),inp.match(hexPat)||inp.match(rulPat)||inp.match(conPat)?(console.log(`Player entered: ${inp}`),inp.match(hexPat)?preview?alert("To preview another address, you must first refresh the token."):(console.log("Valid hex address has been entered"),preview=!0,game=!1,repopU=!1,mode<5?mode++:mode=0,previewBin=createBin(inp),char=chars[mode],console.log(`Logic gate that will be applied next transfer: ${char}`),previewSeed=setSeed(previewBin,cOwnerBin),createBin(previewSeed),seedSpaced=0==idB?[0,0,0,0].concat(previewSeed,[0,0,0,0,0]):[0,0,0,0,0].concat(previewSeed,[0,0,0,0]),(sE=[]).push(seedE(seedSpaced)),inp="",rec=!1,frameRate(1),bfrChange()):inp.match(conPat)&&!0===matured?(console.log("Conway mode engaged!"),console.log("John Horton Conway FRS (26 December 1937 - 11 April 2020) devised the 'Game of Life' cellular automaton in 1970."),bfr=45,live="black",dying="white",dead="white",bkg="white",showoff=!1,joy=!1,grad=!1,pro=!1,zoom=!1,conway=!0,style=1,rad=0,upR(0),frameRate(1),bfrChange()):inp.match(rulPat)&&customRulePrev?(console.log("Valid ruleset pattern has been entered"),formRule(inp,"Temporary Custom Ruleset"),frameRate(1),upR(4)):(console.log("Input valid but rejected"),alert("That feature hasn't been unlocked...yet."))):(console.log("Input rejected"),!0===matured?alert("Input rejected. Enter an Ethereum public address or a ruleset in the form Bn/Sn (Conway's Game of Life ruleset is B3/S23 which means that cells are born in the next cycle if they have 3 neighbors, and cells survive to the next cycle if they have 2 or 3 neighbors)."):alert("Input rejected. Enter an Ethereum public address.")),inp="",rec=!1}function keyTyped(){let e=key.toUpperCase();if("\"===e&&(!1===rec?(rec=!0,(input=createInput()).position(window.innerWidth/2-80,window.innerHeight/2),(button=createButton("⏵")).position(input.x+input.width,input.y),button.mousePressed(checkInput)):(rec=!1,input.hide(),button.hide())),!1===rec){if(" "===e)mousePressed();else if("S"===e)saveCanvas(`ChainLife-${tID}_Level-${level}_Cycles-${count}`,"png");else if("E"===e)saveStrings([`#C Pattern of Chainlife Token ${tID}`,`x = 13, y = 13, rule = B${list(rule[rset][1])}/S${list(rule[rset][2])}`,sE],`ChainLife-${tID}_Level-${level}_Pattern`,"rle");else if("D"===e)saveStrings([`ChainLife token: ${tID}`,`Level ${level} (transfer count: ${tCount}) + level shift: ${lShift})`,`Random token entropy: ${scriptInputs.token_entropy}`,`Previous owner (hexidecimal): ${scriptInputs.previous_owner}`,`Current owner (hexidecimal): ${scriptInputs.current_owner}`,"","The seed is made by applying a logic gate to the binary representations of the owner addresses...",`Previous owner (binary): ${pOwnerBin}`,`Current owner (binary): ${cOwnerBin}`,`Seed (after ${char} operation): ${seedBin}`,`Seed Pattern (RLE): ${sE}`],`ChainLife-${tID}_Data`);else if("L"===e&&game)saveStrings(log,`ChainLife-${tID}_Level-${level}_GameLog`,"txt");else if("F"===e&&flipU&&!grad){let t=live;live=dead,dead=t}else if("O"===e&&zoom&&bfr<40&&!endLog)bfr++,bfrChange();else if("I"===e&&zoom&&bfr>5&&!endLog)bfr--,bfrChange();else if("A"===e&&repopU)repop=!repop,game=!1,repopC=0,console.log(`Repopulation: ${repop}. Game log is disabled until reload.`);else if("R"===e&&pro&&!grad){let l=live;live=dying,dying=dead,dead=l}else"T"===e&&zenMint?(grad=!1,count%2==0?(live="#111111",dead="#dfdff2"):(live="#dfdff2",dead="#111111"),dying="#1b1bb3",bkg=dead):"Y"===e&&zenMint?(grad=!1,count%2==0?(live="#fcd612",dead="#275bb2"):(live="#275bb2",dead="#fcd612"),dying="#43AA8B",bkg=count%2==0?"white":"black"):"M"===e&&mm?(grad=!1,live="#00FF41",dying=count%2==0?"#003B00":"#008F11",dead="#000000",bkg="#000000"):"B"===e?(grad=!1,live=col[p][0],dying=col[p][1],dead=col[p][2],1==p?fBKG():bkg=dead):"J"===e?joy=!1:"G"===e&&joy?(ghost=!0,liveMem=live,live=dead,dying=dead):"X"===e&&lit?style=Math.floor(random(3,11)):"C"===e?showCyc=!showCyc:"1"===e?frameRate(1):"2"===e?frameRate(2):"3"===e?frameRate(5):"4"===e?frameRate(10):"5"===e?frameRate(20):"6"===e?rO.includes(0)&&upR(0):"7"===e?rO.includes(1)&&upR(1):"8"===e?rO.includes(2)&&upR(2):"9"===e?rO.includes(3)&&upR(3):"0"===e&&matured&&customRuleOn?upR(4):"Q"===e?(clicked=!1,showNcount=!showNcount):"Z"!==e||endLog?"H"===e?(clicked=!1,showHelp=!showHelp):"N"===e?step=!0:"<"===e?(0!=htmlCol?htmlCol--:htmlCol=4,document.body.style.backgroundColor=htmlCols[htmlCol]):">"===e&&(4!=htmlCol?htmlCol++:htmlCol=0,document.body.style.backgroundColor=htmlCols[htmlCol]):bfrChange()}else(keyCode===ENTER||keyCode===RETURN)&&checkInput()}function list(e){let t="";for(let l=0;l<e.length;l++)t+=e[l].toString();return t}function mousePressed(){!1===rec&&(clicked=!clicked,showHelp=!1)}function setup(){randomSeed(level),(canvas=createCanvas(canD,canD)).parent("canvas-container"),textAlign(CENTER,CENTER),rectMode(CENTER),noFill(),frameRate(5),colorMode(RGB,255,255,255,1),setGrid(),describeFeatures()}function describeFeatures(){let e=this.canvas.id;this.dummyDOM=document.getElementById(e).parentNode;let t=`<div id="${e}_Description" role="region" aria-label="${altText=`Chainlife is a generative art project that explores two-dimensional cellular automata, and on-chain owner collaboration. It was made by an artist named Matto, and released in 2022. This is a Chainlife token, with ID number, ${tID}. It's World-View location is column, ${wGC}, row, ${wGR}. In this token, the palette being used is called, ${col[p][3]}. By default, this token uses the cellular automata ruleset, ${rule[rset][0]}, which can be switched during play or changed by the token's level. This token's level is, ${level}, which is calculated by adding the number of times the token has been transferred, ${tCount}, and it's on-chain level-shift value, ${lShift}. Any token at level 16 or above is considered matured...`}"></div>`;this.dummyDOM.querySelector(`#${e}`).innerHTML=t}function bfrChange(){clicked=!1,count=0,setGS(),setW(),log=[],setGrid()}function setGS(){gridS=13+2*bfr}function setW(){hW=(w=canD/gridS)/2}function setGrid(){for(let e=0;e<gridS;e++)state[e]=Array(gridS),next[e]=Array(gridS);let t=0;for(let l=0;l<gridS;l++)for(let o=0;o<gridS;o++)l<bfr||l+bfr+1>gridS||o<bfr||o+bfr+1>gridS?state[l][o]=0:(state[l][o]=seedSpaced[t],t++),next[l][o]=0;log=[`Game log of token ${tID} at level ${level}`,`Seed pattern: ${sE}`,`Rule Set: ${rule[rset][0]}`,`Grid size: ${(gridS-2)**2}`,""]}function draw(){shifting&&clicked&&(style=Math.floor(random(3,11))),textSize(w),alive=0,died=0,noStroke(),background(bkg);for(let e=0;e<gridS;e++)for(let t=0;t<gridS;t++)grad&&(live=lerpColor(lerpColor(color(255,0,0,1),color(255,255,0,1),t/gridS),lerpColor(color(0,0,255,1),color(0,255,255,1),t/gridS),e/gridS),dying=color(red(live),green(live),blue(live),.5)),1==state[e][t]?(fill(live),alive++):.5==state[e][t]?(fill(dying),died++):0==e||e==gridS-1||0==t||t==gridS-1?fill(bkg):fill(dead),rW=e*w,cW=t*w,rWw=rW+w,cWw=cW+w,rC=rW+hW,cC=cW+hW,style<4&&(rect(cC,rC,w,w,rad),showoff&&1==state[e][t]&&(R(255,.3),L(255,.4))),4==style&&(showoff&&1==state[e][t]&&rect(cC,rC,2*w/3,2*w/3),quad(cC,rW,cWw,rC,cC,rWw,cW,rC)),5==style&&(showoff&&1==state[e][t]?(rect(cC,rW+w/6,w,w/3),rect(cC,rW+5*w/6,w,w/3)):rect(cC,rC,w,w/3)),6==style&&(showoff&&1==state[e][t]?(rect(cW+w/6,rC,w/3,w),rect(cW+5*w/6,rC,w/3,w)):rect(cC,rC,w/3,w)),7==style&&(showoff&&count%2==1?triangle(cW,rW,cWw,rWw,cW,rWw):triangle(cW,rW,cWw,rWw,cWw,rW)),8==style&&(showoff&&1==state[e][t]&&(rect(cC,rC,w,w/5),rect(cC,rC,w/5,w)),quad(cW+w/7,rW,cWw,rWw-w/7,cWw-w/7,rWw,cW,rW+w/7),quad(cWw-w/7,rW,cWw,rW+w/7,cW+w/7,rWw,cW,rWw-w/7)),9==style&&(showoff?arc(cC,rC,w,w,mouseX/canD*PI*2,mouseY/canD*PI*2,PIE):count%2==0?arc(cC,rC,w/2,w,2*PI,2*PI,PIE):arc(cC,rC,w,w/2,2*PI,2*PI,PIE)),10==style&&(vB=1==state[e][t]?1:.25,showoff&&1==vB&&H(vB),H(vB)),11==style&&(1===state[e][t]?(stroke(live),vB=1):.5===state[e][t]?(stroke(dying),vB=.5):(stroke(dead),vB=0),strokeWeight(w/12),showoff&&(k(vB),idB=0===idB?1:0),k(vB),noStroke());if(showHelp&&!clicked){showNcount=!1,showCyc=!1,fill("#eeeeee"),rect(cDH,cDH,canD,canD),fill("#111111");let l=canD/25;textSize(canD/35),textStyle(BOLD),text("Chainlife Help",cDH,1.5*l),textSize(canD/40),textStyle(NORMAL),text('Tap/click on the image or press "SPACE" to pause/play the Chainlife.',cDH,3*l),text('Press "1"/"2"/"3"/"4"/"5" to set the speed.',cDH,4*l),text('Press "N" to run one cycle and show the next generation.',cDH,5*l),text('Press "Z" to return the Chainlife to the starting seed.',cDH,6*l),text('Press "Q" to show each cell\u0027s quantity of neighbors.',cDH,7*l),text('Press "C" to show the cycle/generation count.',cDH,8*l),text('Press "6"/"7"/"8"/"9"/"0" to set the ruleset.*',cDH,9*l),text('Press "A" to enable auto-repopulation (disables game-log).*',cDH,10*l),text('Press "I" or "O" to zoom in or out.*',cDH,11*l),text('Press "B" to return the palette to the base/starting state.',cDH,12*l),text('Press "F" to flip the live/dead cell colors.*',cDH,13*l),text('Press "R" to rotate through all palette colors.*',cDH,14*l),text('Press "S" to download a frame (png). Try it now to save this info.',cDH,15*l),text('Press "E" to download the starting seed (uncompressed rle).',cDH,16*l),text('Press "D" to download the token\u0027s current data (txt).',cDH,17*l),text('Press "L" to download the game log (txt).',cDH,18*l),text('Press "<"/">" to cycle through palette colors for the color-matte.',cDH,19*l),text('Press "\" to open the text-input field for previewing changes...',cDH,20*l),text("-Enter an Ethereum address to preview the starting seed if transferred there.",cDH,21*l),text("-Enter a ruleset (Bn/Sn) to preview how an on-chain custom rule will play.*",cDH,22*l),textSize(canD/50),text("More detail can be found on the project's websites (chainlife.xyz / chainlife.nft / matto.xyz).",cDH,23*l),text("*Some functions are unlocked after reaching a certain level.",cDH,24*l)}if(logged||(game&&!endLog&&(0==count?log.push(`At cycle ${count}, the population is ${alive}`):log.push(`At cycle ${count}, the population is ${alive} (${alive-born} survived, ${born} born, ${died} died).`)),logged=!0),joy&&clicked){if(1==joyS){let o="#111111"==live&!ghost||"#111111"==liveMem?"black":"white";(jLineCol=lerpColor(color(live),color(o),.8)).setAlpha(.15),stroke(jLineCol),strokeWeight(1)}for(let r=0;r<gridS;r++)for(let n=0;n<gridS;n++){if(rC=r*w+hW,cC=n*w+hW,1==joyS&&1==state[r][n])for(let a=0;a<random(100,200)-gridS;a++){let d=random(3*w,15*w);line(cC,rC,random(-d,d)+cC,random(-d,d)+rC)}function s(e,t,l,o){let r=o;for(let n=0;n<l;n++)fill(255,255,255,r),circle(e,t,n),r-=r/l}2==joyS&&(1==state[r][n]&&(0==lTri||2==lTri)&&s(cC,rC,randomGaussian(.5,4)*w,random(0,.03)),.5==state[r][n]&&(1==lTri||2==lTri)&&s(cC,rC,randomGaussian(.5,3)*w,random(0,.02)))}noStroke()}fill(live),stroke(dead),strokeWeight(w/8),textSize(.75*w),born=0;for(let c=1;c<gridS-1;c++)for(let $=1;$<gridS-1;$++){let _=0;for(let u=-1;u<=1;u++)for(let f=-1;f<=1;f++)(0!=u||0!=f)&&(_+=Math.floor(state[c+u][$+f]));!0!==showNcount||!1!==clicked||ghost||text(_,$*w+w/2,c*w+w/2);let h=state[c][$],g;1!=h&&rule[rset][1].includes(_)?(g=1,born++):g=1==h&&rule[rset][2].includes(_)?1:1==h?.5:0,next[c][$]=g}if(noStroke(),textSize(w),repop&&clicked){repopC>0&&repopC++;let m=alive/(gridS*gridS)*100;(alive<15||m<1)&&(repopC=1,upR(3)),50==repopC&&(repopC=0,upR(ruMem))}if(0==alive&&0==died&&count>0&&game&&!showHelp){textSize(canD/30),""==cyc&&(score=Math.max(count-2,0)),fill(dead),rect(cDH,cDH,canD,cDH/2),fill(live),bil?(textSize(canD/30*.75),cyc="> 1,000,000,000"):cyc=score.toString();let v=`This Chainlife survived ${cyc} cycles.`,y=`这个 生命线 存活了 ${cyc} 个周期.`,S=`Esta 'Cadena de vida' sobrevivió ${cyc} ciclos.`;text(v,cDH,cDH-cDH/6),text(y,cDH,cDH),text(S,cDH,cDH+cDH/6),endLog||log.push(v),endLog=!0,textSize(w)}if(clicked||step)logged=!1,count>999999999&&(bil=!0,count=0),count++,createNext(),step=!1;else if(!ghost){fill(live),rect(w,w,2*w,2*w),rect(canD-w,w,2*w,2*w),rect(w,canD-w,2*w,2*w),rect(canD-w,canD-w,2*w,2*w),matured?(rect(cDH,0,canD,w),rect(canD,cDH,w,canD),rect(cDH,canD,canD,w),rect(0,cDH,w,canD)):customRulePrev&&(rect(cDH,0,canD/2,w),rect(canD,cDH,w,canD/2),rect(cDH,canD,canD/2,w),rect(0,cDH,w,canD/2)),fill(dead);for(let b=0;b<4;b++)rO.includes(b)&&(C(ruLoc[b][0],ruLoc[b][1],hW),1===ruLoc[b][2]&&(fill(live),C(ruLoc[b][0],ruLoc[b][1],hW/2),fill(dead)));function D(e,t){arc(canD-w,w,w,w,e,t,PIE)}function C(e,t,l){rect(e*w,t*w,l,l)}1===ruLoc[4][2]&&(fill(live),C(ruLoc[4][0],ruLoc[4][1],.75*w),fill(dead),C(ruLoc[4][0],ruLoc[4][1],hW/2)),D(0-HALF_PI,0),flipU&&D(0,HALF_PI),inv&&D(HALF_PI,PI),(pro||conway)&&D(PI,PI+HALF_PI),lit&&(fill(live),circle(canD-w,w,.6*w),fill(dead)),mm&&rect(canD-w,w,.25*w,.25*w),expa&&rect(w,canD-w,.25*w,.25*w),noFill(),stroke(dead),strokeWeight(w/12),expa||rect(w,canD-w,.66*w,.66*w),(zoom||conway)&&circle(w,canD-w,w),noStroke(),strokeWeight(1),fill(dead),textStyle(BOLD),text(char,canD-w,canD-w)}function R(e,t){fill(color(e,e,e,t)),rect(cC,rC,2*w/3,2*w/3,rad)}function L(e,t){fill(color(e,e,e,t)),rect(cC,rC,w/3,w/3,rad)}function H(e){quad(cC+random(-e,e)*hW,rW,cWw,rC+random(-e,e)*hW,cC+random(-e,e)*hW,rWw,cW,rC+random(-e,e)*hW)}function k(e){e+=Math.min(level,18)/6;for(let t=0;t<lineCount;t++)0==idB?line(cC+random(-e,e)*hW,rW+random(-w/6,w/6),cC+random(-e,e)*hW,rWw+random(-w/6,w/6)):line(cWw+random(-w/6,w/6),rC+random(-e,e)*hW,cW+random(-w/6,w/6),rC+random(-e,e)*hW)}showCyc&&!ghost&&0==score&&(matured&&(fill(dead),rect(cDH,hW,7*w,w)),fill(live),textStyle(BOLD),text(count,cDH,hW+w/10))}function createNext(){let e=state;state=next,next=e}addAttri("Esoterra Type",esoTlist),addAttri("Esoterra Entropy",esoTen),addAttri("Palette State",palStateStr),addAttri("Custom Rule Previews",evolStrVal(customRulePrev)),addAttri("Zoom",evolStrVal(zoom)),addAttri("Repopulation",evolStrVal(repopU)),addAttri("Maturation Speed",maturitySpeedStrings[idDelay+1]),addAttri("Maturity Reached",matured),addAttri("Zen. Mint",zenMint),lit&&addAttri("Lit?","LIT!"),mm&&addAttri("Eventuality","Awakened"),sessionStorage.setItem("attributes",JSON.stringify(attributes));