retroredge [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=102727 Dragon Curve (PICO-1K Jam 2025) <p> <table><tr><td> <a href="/bbs/?pid=173601#p"> <img src="/bbs/thumbs/pico8_hadubiguku-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=173601#p"> Dragon Curve demo</a><br><br> by <a href="/bbs/?uid=102727"> retroredge</a> <br><br><br> <a href="/bbs/?pid=173601#p"> [Click to Play]</a> </td></tr></table> </p> <p>A simple graphical demo for the <a href="https://itch.io/jam/pico-1k-2025">PICO-1K Jam 2025</a> which creates an animated <a href="https://en.wikipedia.org/wiki/Dragon_curve">Dragon Curve</a>.</p> <p>A Dragon Curve can be generated physically from repeatedly folding a strip of paper in half and hence the lines in a Dragon Curve never cross each other.</p> <p>The different colours represent the level of recursion that each segment was generated at by the algorithm. </p> <p>You can use the cursor keys to move he viewport and ZX / NM / CV to zoom in and out to explore the curve in more detail as it renders or once it has finished.</p> <p>The compressed byte size of the cartridge is 643. I've made very little effort to save bytes because the program is so simple in the first place.</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>-- dragon curve -- by retroredge,v0.1,2025 dirs = {{ 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 }} rec_dep = 10 line_len = 2 sx = 84 sy = 94 curve = {} count = 1 function flp(tbl) new = {} for i = 1, #tbl do if tbl[i] == &quot;l&quot; then add(new, &quot;r&quot;) else add(new, &quot;l&quot;) end end return new end function rev(tbl) new = {} for i = #tbl, 1, -1 do add(new, tbl[i]) end return new end function gen_curve(letters, lvl) new = flp(letters) add(curve, &quot;l&quot;) new = rev(new) for i = 1, #new do add(curve, new[i]) end if lvl &lt; rec_dep then gen_curve(curve, lvl + 1) end end function wrap1to4(i) return ((i - 1) % 4) + 1 end function _init() gen_curve(curve, 0) end function _draw() cls(0) dir_ind = 1 x = sx y = sy col_max = 1 col = 4 for i = 1, count do if i &gt; col_max then col_max = shl(col_max, 1) col += 1 end dir = dirs[dir_ind] nx = x + dir[1] * line_len ny = y + dir[2] * line_len line(x, y, nx, ny, col) x = nx y = ny if curve[i] == &quot;l&quot; then dir_ind = wrap1to4(dir_ind - 1) else dir_ind = wrap1to4(dir_ind + 1) end end if count &lt; #curve then count += 1 end end function _update() if btn(4) then line_len += 1 elseif btn(5) then line_len -= 1 end line_len = min(max(line_len, 2), 16) if btn(1) then sx += 1 elseif btn(0) then sx -= 1 end if btn(2) then sy -= 1 elseif btn(3) then sy += 1 end end </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=151446 https://www.lexaloffle.com/bbs/?tid=151446 Mon, 08 Sep 2025 20:00:42 UTC Sunflower (PICO-1K Jam 2024) <p> <table><tr><td> <a href="/bbs/?pid=154453#p"> <img src="/bbs/thumbs/pico8_gyejateb-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=154453#p"> Sunflower spiral demo</a><br><br> by <a href="/bbs/?uid=102727"> retroredge</a> <br><br><br> <a href="/bbs/?pid=154453#p"> [Click to Play]</a> </td></tr></table> </p> <p>A simple graphical demo for the <a href="https://itch.io/jam/pico-1k-2024">PICO-1K Jam 2024</a> which creates an animated pattern similar to the spiral pattern that seeds in a sunflower make.</p> <p>I'd played around with this in lockdown using Java libGDX and decided to port it to PICO-8 for the 1K jam.</p> <p>You can use the left and right arrows to change the radius of the dots.</p> <p>The compressed byte size of the cartridge is 312. I've made little effort to save bytes because the program is so simple in the first place.</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>-- sunflower -- by retroredge,v0.1,2024 function _init() n=0 f=0.618 d=0.00002 r=1 end function _draw() cls() for i=1,n do local l=i/n local a=(3.14*f*i) local x=(l*cos(a))*64 local y=(l*sin(a))*64 circfill((64)+x,(64)+y,r,c(i)) end end function _update() if (n&lt;501) n+=1 f=f+d if (btnp(⬅️) and r&gt;0) r-=1 if (btnp(➡️) and r&lt;11) r+=1 end function c(i) if i%3==0 then return 10 elseif i%5==0 then return 11 elseif i%7==0 then return 8 else return 12 end end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=144294 https://www.lexaloffle.com/bbs/?tid=144294 Wed, 18 Sep 2024 20:49:07 UTC