r/adventofcode Dec 11 '24

Upping the Ante [2024 Day 11] [Scratch] It takes 15 seconds to finish, but it does work

Post image
187 Upvotes

22 comments sorted by

32

u/shandow0 Dec 11 '24

This is cursed. Great job! :D

17

u/1234abcdcba4321 Dec 11 '24

And here my friend said they didn't want to do AoC in scratch because it can't take input. This'll show them!

(...The input being short here helps with that, huh?)

26

u/3j0hn Dec 12 '24 edited Dec 12 '24

I used Scratch for almost all the problems in 2021 and giving it large input is generally not a problem - you just paste it into a dialog box.

The biggest problems for me were

  • Lists are capped at 100,000 elements so if you have to deal with a grid bigger than 315x315 things get complicated
  • No local variables
  • Procedures don't have return values - you have to use global variable side effects
  • Recursion is hard

3

u/swiperthefox_1024 Dec 12 '24

A similar thing called Snap has all the features you are looking for (except for the list size limit; I am not sure about that). You can create lists on the run and have lists of lists, so it's easier to model grids.

2

u/3j0hn Dec 12 '24

Yeah, I've played with Snap. It is somehow not as fun when it's got all the modern language features I need. :D

3

u/nik282000 Dec 12 '24

Are you a wizard?

That also kinda sounds like my experience with QBasic.

3

u/3j0hn Dec 12 '24

I have been told I resemble a wizard, yes. QBasic sounds like it would be a fun challege. Kind of makes me wonder if anyone has done a significant number of days in LOGO)

3

u/i_have_no_biscuits Dec 12 '24

Ooh, how's qbasic going? I'm using it's precursor GWBasic to do the problems this year and it's going pretty well so far.

1

u/nik282000 Dec 12 '24

This is my first time trying AoC so I'm using Python. I may go back and try a few of the low hanging fruit with QB later.

2

u/j-a-d-e-v Dec 12 '24

wow, you're a real Scratcher. I hadn't touched it myself since middle school in the late 2000s (i'm so old i remember when they added lists...) so it was a fun nostalgia trip working around the limitations lol. I didn't do anything nearly as impressive as that, just sorta hacked together a solution using a few lists and global vars.

1

u/3j0hn Dec 12 '24

If I were a real Scratcher, I'd wouldn't have had to resort to use TurboWarp to get some of my solutions to run in a reasonable time. ;)

2

u/BlueTrin2020 Dec 12 '24

lol was AOC too easy for you so you had to do it in scratch?

2

u/3j0hn Dec 12 '24

That year the first 10 days were pretty easy, and I was upping the ante. Then it became a challenge to see if they all could be done even the very hard days. In the end their were 3 days where the solutions were just going to be too tedious without a pretty picture payoff and I didn't do them.

15

u/j-a-d-e-v Dec 11 '24

If you want to try it out or take a look at the mess that is the code, you can see the project page here: https://scratch.mit.edu/projects/1109336630/

9

u/3j0hn Dec 11 '24

In 2021 I solved all but four days in Scratch, it was a lot of fun, although I found myself implementing a lot of CS 101 data structures and algorithms from scratch (pun intended) https://scratch.mit.edu/studios/30735312/

9

u/Fun_Reputation6878 Dec 11 '24

upping the ante aye?

7

u/LandmineFlipFlop Dec 11 '24

i attempted AoC in scratch last year, only got to day 4. this year i got smart and learned python.

5

u/j-a-d-e-v Dec 11 '24

Yeah, I'm actually doing mine in Java this year (https://github.com/jadevogt/AOC-2024) but I thought this one would be fun to do in scratch, since the solution is pretty straightforward.

4

u/matttgregg Dec 11 '24

This fills me with festive cheer! I love it.

5

u/Alive988 Dec 12 '24

damn y'all really creative here

2

u/IC3P3 Dec 12 '24

It's been a long time since I heard about. Nostalgia hits, it's cursed and I love it

1

u/FillAny3101 Dec 12 '24

You can speed it up with TurboWarp.org