On Thu, Apr 23, 2009 at 10:39 PM, Seth Thomas Rasmussen
<[email protected]> wrote:
> On Thu, Apr 23, 2009 at 12:55 PM, Martin DeMello
> <[email protected]> wrote:
>> Wrote a small shoes-based animation for this week's ruby quiz. Bit too
>> trivial to post to the shoebox, but  I thought I'd post it here since
>> it's a nice example of drawing on a canvas rather than creating shapes
>> in the app itself.
>
> Cool! Couple problems I ran into, though:
>
> 1) The instance methods defined outside the app block are not
> accessible inside it. I moved them inside the app block and things
> worked well, except..

Which version of shoes are you using? This worked nicely for me - they
aren't really instance methods, they're toplevel methods that access
the shoes bit via the global $canvas object (my philosophy of shoes is
that if you're writing something small and quick, globals are your
friend)

> 2) With the "Stack" algorithm, I notice some delays at times where my
> guess is it's refilling already filled squares or something? It
> eventually fills them all.

Yeah, I've noticed that with both algorithms, I think it's where it's
repeatedly trying to fill in a square but finding it already full.
(Since two squares could put the same neighbour into the stack or
queue). Ideally of course there'd be a supplementary hash to track
that. Will do that before I put it onto the shoebox. Just wanted to
demonstrate the drawing to the canvas here, since someone was asking
about that recently.

> Feel like I'm being a total killjoy on the list lately, but just trying to 
> help!

No, all suggestions welcomed :)

martin

Reply via email to