logoalt Hacker News

A Stackless Floodfill Automaton

22 points • by andsoitis • last Sunday at 8:18 PM • 6 comments • view on HN

Comments

hyperhello • today at 3:30 PM

The algorithm uses about half a byte per pixel and saves the path it follows. That kind of implies that the stack is still there and present, it’s just bounded to the number of pixels, and could actually be modified to just use a bounded area of the heap. But conceptually it’s easier to follow the way the paper was written. Neat.

zimpenfish • today at 3:06 PM

Huh, that's useful because I had to write a floodfill a couple of days ago and it was a pain in the arse.

I'll be converting my code to the stackless version toot sweet.

➕ show 1 reply
voidUpdate • today at 3:49 PM

How does this deal with one pixel gaps? The algorithm can enter it just fine but there's no space to go back out again, and there doesn't seem to be a system for backtracking, unless I've misunderstood the algorithm

➕ show 1 reply