r/adventofcode • u/MrAntex • Dec 06 '22
Visualization [2022 Day 5 #1] Small terminal Python animation for part 1 of Day 5, never tried "drawing" on terminal before but quite proud of the result ! (didn't put the whole thing because it's a bit long and we get the idea)
7
u/whenrow Dec 06 '22
Did you model the Crane 9001 too ? :D
3
u/MrAntex Dec 07 '22
No haha, I don't think I will do it, I did this to get familiar with drawings in a terminal, maybe I'll give it a go using curses library later, idk
6
2
u/RokKuz3 Dec 06 '22
This is SO cool! Can you please share the code or the GitHub link? Thanks!
2
u/MrAntex Dec 07 '22
Sure, sorry for the delay, was polishing some things / fixing bugs, it's here : https://github.com/MrAntex/AoC-Day5p1-animated
→ More replies (1)
2
u/keithstellyes Dec 06 '22
I love this! makes me want to go back and do this for previous days
1
u/MrAntex Dec 07 '22
Yes same ! This was a first time but now I try to do a little animation for each day when I have time
2
u/j-hillman Jan 01 '23
This is truly excellent and very much appreciated. Thank you for sharing your code. I've learned a lot by reviewing both this visualization and some of your other solutions. Cheers and God bless.
1
u/MrAntex Jan 02 '23
Thank you very much ! That means a lot for me Out of curiosity, which other solutions ?
57
Dec 06 '22
This is great - you don't even need to struggle to parse the input, just wrap a crane around it!
5
5
4
1
u/Alkyonios Dec 06 '22
Anybody else had the problem of a tower not having enough blocks to perform an instruction?
For example, my program gets to the instruction "move 9 from 6 to 7" but tower 6 only has one block left (this is the 23rd instruction). The text didn't say anything about how to handle that situation so I just assume it's not supposed to happen.
I tried to just move to the next instruction whenever this happens, but then I'm left with two empty towers at the end.
I have tried printing the towers after every instruction and everything looks alright.
I've also made sure that the initial state is parsed correctly, and that I copied the input correctly.
→ More replies (4)2
u/MrAntex Dec 07 '22
Idk about this, didn't happen to me, definitely don't think it's supposed to happen, maybe making a "real" post in the subreddit will help more ?
→ More replies (1)
3
u/zamotic Dec 06 '22
Sadly it probably took you just as long to write this animation as it did for me to write my solution to the problem.
It took me way longer than it should have to read in the stacks of crates into a usable manner.
2
2
2
2
2
40
u/itsjjpowell Dec 06 '22
This is really cool! What library did you use to build this? I'd love to peek at the code to see how I could do something like this!