memoscan
← all memos

Memo 0x89e522ec…425413 on Ethereum

function updateTreasure(){if(TREASURE_MAP){let e=riverDur;if(myFrameCount==e)tps=makeTreasure();else if(myFrameCount>e){let t=tps.length,r=myFrameCount-e,o=r+1;if(o<t&&o%2==0){let e=tps[r],t=tps[o];overlayFg.strokeWeight(.5),overlayFg.stroke(edgeColor),overlayFg.line(e.x,e.y,t.x,t.y)}else o==t&&xMarksTheSpot(overlayFg)}}}function updateContours(){1==myFrameCount&&contours.draw(landBg)}function updateRiver(){myFrameCount<riverDur?(river.checkOxbows(),river.updateOxbows(),river.update(),river.setEndPoints()):myFrameCount==riverDur&&(plotsImg.loadPixels(),river.writeColors(plotsImg),plotsImg.updatePixels())}function updatePlots(){if(myFrameCount==plotStartFrame&&createPlotNetwork(river.getPs(),river.getBs()),myFrameCount>=plotStartFrame){plotsImg.loadPixels();for(let e=0;e<plots.length;e++)plots[e].update();for(let e=0;e<plots.length;e++)plots[e].render();plotsImg.updatePixels();for(let e=0;e<plots.length;e++)plots[e].drawLine()}}function updateRail(){HAS_RAILROAD&&(myFrameCount==riverDur?rail=new Rail(river.getStartPos(),river.getEndPos()):myFrameCount>riverDur&&rail.update())}function updatePoisson(){myFrameCount==riverDur&&(poisson.solve(),poisson.draw(landBg))}function updateContours(){myFrameCount==riverDur&&(contours.solve(river.getPs()),contours.draw(landBg))}function cleanPlots(){for(let e=0;e<plots.length;e++){plots[e].isDead()&&plots.splice(e,1)}}function drawOverlay(){let e=R.random_int(0,1);BIOME==FARMLAND&&(e=1),2==RENDER_TYPE&&(e=0),0==e?borderWidth=.075*MYSIZE:1==e&&(borderWidth=.125*MYSIZE),overlayFg.noFill(),overlayFg.strokeWeight(borderWidth),overlayFg.stroke(bgColor),overlayFg.rect(0,0,MYSIZE,MYSIZE);let t=.5,r=2*t,o=R.random_int(2,5);for(let e=0;e<o;e++){let e=R.random_num(.25*mainSw,2*mainSw);overlayFg.strokeWeight(e),overlayFg.stroke(edgeColor),overlayFg.rect(borderWidth*t,borderWidth*t,MYSIZE-borderWidth*r,MYSIZE-borderWidth*r),r=2*(t=R.random_num(.3,.5))}}function update(){myFrameCount<riverDur&&riverFg.clear(),updateRiver(),BIOME!=DESERT&&BIOME!=MOUNTAINS&&BIOME!=ARCTIC&&BIOME!=SWAMP||updatePlots(),BIOME!=DESERT&&BIOME!=SWAMP&&BIOME!=ARCTIC||updatePoisson(),BIOME==MOUNTAINS&&updateContours(),BIOME!=FARMLAND&&updateRail(),updateTreasure()}function draw(){if(background(bgColor),myFrameCount<TOTAL_DUR&&(update(),myFrameCount>riverStartFrame&&(river.drawOxbows(),river.draw()),HAS_RAILROAD&&rail&&rail.draw(),1==myFrameCount&&HAS_BORDER&&drawOverlay()),myFrameCount==riverDur+1&&BIOME==FARMLAND&&(setupQuadTree(),setupField()),myFrameCount>riverDur+1&&qUpdated&&field.draw(),myFrameCount<=riverDur&&BIOME==FARMLAND&&(landBg.blendMode(REMOVE),drawScreenOverlay(landBg,fgColor,2,.5*mainSw),landBg.blendMode(BLEND)),image(landBg,0,0,dim,dim),image(plotBg,0,0,dim,dim),image(riverBg,0,0,dim,dim),image(riverFg,0,0,dim,dim),image(overlayFg,0,0,dim,dim),clean(),SAVE_IMAGE){let e=(new Date).getTime();save(buffer,str(e),"png"),SAVE_IMAGE=!1}if(SAVE_PRINT_RES||SAVE_ALT_PRINT_RES){if(myFrameCount==TOTAL_DUR){let e=(new Date).getTime();save(buffer,str(e),"png"),SAVE_PRINT_RES=!1,SAVE_ALT_PRINT_RES=!1}let e=map(myFrameCount,1,TOTAL_DUR,0,dim);fill(255,0,0),noStroke(),rect(0,dim-5,e,dim)}if(SHOW_DETAILS){let e=125,t=dim-370,r=20;fill(color(0)),INVERTED&&fill(color(255)),noStroke(),textSize(15),textFont("Serif"),text(myFrameCount,e,dim-120),text("Biome: ",e,t+0*r),text("Composition: ",e,t+1*r),text("Meander Type: ",e,t+2*r),text("Drifter: ",e,t+3*r),text("Line type: ",e,t+4*r),text("Color type:",e,t+5*r),text("Population: ",e,t+6*r),text("Grid: ",e,t+7*r),text("Palette: ",e,t+8*r),text("History: ",e,t+9*r),text("Railroad: ",e,t+10*r),text("Treasure Map: ",e,t+11*r),e+=200,text(frameRate(),e,dim-120),text(BIOMES[BIOME],e,t+0*r),text(COMPS[COMP],e,t+1*r),text(MEANDER_TYPES[MEANDER_TYPE],e,t+2*r),text(DRIFTER?"TRUE":"FALSE",e,t+3*r),text(LINE_TYPES[LINE_TYPE],e,t+4*r),text(COLOR_TYPES[COLOR_TYPE],e,t+5*r),text(CITY_TYPES[CITY_TYPE],e,t+6*r),text(GRID_TYPES[GRID_TYPE],e,t+7*r),text(PALETTES[PALETTE_ID],e,t+8*r),text(HISTORY_TYPES[HISTORY_TYPE],e,t+9*r),text(HAS_RAILROAD?"TRUE":"FALSE",e,t+10*r),text(TREASURE_MAP?"TRUE":"FALSE",e,t+11*r)}myFrameCount++,introAnim=pow(map(myFrameCount,0,introDur,0,1,!0),2),riverFramePer=map(myFrameCount,0,riverDur,0,1),myFrameCount%riverHistoryIter==1&&riverHistoryCount++}function clean(){cleanPlots()}