2 days, um no, 0 days since last bug


My goal with Lua Carousel like with my other recent projects is to get to a point of zero updates. I want to get to an artifact that is runnable forever. My choices of Lua and LÖVE are driven by this goal.

But it's very much an aspirational goal so far. Right now I'll take 1 day without a new version :D In 14 days since launch I've put out 25 versions. But there are some early signs of progress. We just had 2 whole days without a new version! And then right as I was working on a post to celebrate this milestone -- I found a bug X-(  Errors in the `car.mousepressed` handler would crash Carousel.

To celebrate (or mourn) the milestone, here's a program I made this morning:

Rects = {}
function car.draw()
  for _,r in ipairs(Rects) do
    color(r.r, r.g, r.b)
    rect(r.mode, r.x,r.y, r.w,r.h)
  end 
end
function car.mousepressed(x,y, button)
  local r = randrect()
  if oaa(r) then
    r.mode = 'line'
  else
    r.mode = 'fill'
  end
  table.insert(Rects, r)
end
function oaa(a)
  for _,r in ipairs(Rects) do
    if oa(a, r) then return true end
  end
end
function s(lo, hi, b)
  return lo <= b and hi >= b
end
function overlaps(alo,ahi, blo,bhi)
  return s(alo,ahi, blo)
    or s(alo,ahi, bhi)
    or s(blo,bhi, alo)
    or s(blo,bhi, ahi)
end
function oa(a, b)
  return overlaps(a.x, a.x+a.w, b.x,b.x+b.w)
    and overlaps(a.y, a.y+a.h, b.y, b.y+b.h)
end
function randrect()
  local w = rand(30, 120)
  local h = rand(90, 300)
  local x = rand(Safe_width-w-5)
  local y = rand(Safe_height-h-5)
  return {x=x, y=y, w=w, h=h,
    r=rand(), g=rand(), b=rand()}
end

If you try pasting this program into Lua Carousel, remember to first run the abbreviations on one of the example screens. Or if you've deleted it, here are the abbreviations this program uses:

g = love.graphics
rect = g.rectangle
color = g.setColor
rand = math.random

Once you get it running, try clicking with a mouse or finger. Where you click won't matter, and you'll be able to create images like you see above.

Files

carousel-az.love 108 kB
Dec 07, 2023
carousel-az-safe.love 108 kB
Dec 07, 2023

Get Lua Carousel

Leave a comment

Log in with itch.io to leave a comment.