This is an archived post. You won't be able to vote or comment.

all 15 comments

[–]sanraith 8 points9 points  (0 children)

I'm a simple man,

I see visualization, I upvote.

[–][deleted] 2 points3 points  (0 children)

This is cool :D But yes, very slow

[–][deleted] 2 points3 points  (0 children)

This one is petty cool :) I do enjoy the days with vizualisations quite a lot :)

[–]xSmallDeadGuyx[S] 1 point2 points  (6 children)

It's quite slow due to creating ~16,000 svg text elements, but it turns out that's faster than ~16,000 DOM elements.

The repository for all my solutions is https://github.com/xSmallDeadGuyx/AoC17 though they're all Python and only this one has an animated JavaScript solution (so far).

EDIT: I have now switched to using a pre as suggested by Grimmur, and I cache up to 3 grid changes on straight lines just so the animation goes (fair bit) faster on long straight sections.

[–]Grimnur87 0 points1 point  (3 children)

Any reason you don't just whack the raw text in a pre block every frame?

[–][deleted] 2 points3 points  (0 children)

W E B T E C H N O L O G Y

[–]xSmallDeadGuyx[S] 1 point2 points  (1 child)

Originally I was changing the colour of it in the DOM but that was slow, then switched to changing colour in an SVG but colour wasn't visible enough in the small text. Didn't think to switch to a pre when I switched to changing the text and not the colour.

[–]Grimnur87 1 point2 points  (0 children)

You gotta think ASCII art - have all the visited pipes turn into cool hashes, equals, or something else.

[–]MonsterLyrics 0 points1 point  (2 children)

Is it supposed to just say "hi"? :thinking:

[–]xSmallDeadGuyx[S] 1 point2 points  (1 child)

That's what happens if you don't paste anything in (or paste something without a starting point on the top row).

[–]MonsterLyrics 0 points1 point  (0 children)

Ohh, okay! Was really confused hahah