Advent of Code 2022 - Day 1

https://adventofcode.com

This is a thread to discuss Day1 (which starts on 1st December at 05:00 UTC ) :slight_smile:

https://adventofcode.com/2022/day/1

REMEMBER!
It is VERY important NOT to write any public spoilers :slight_smile:
ALWAYS keep spoiler stuff hidden inside one of these

Summary

This text will be hidden

which you can obtain by clicking on the gear icon

image

Good luck :slight_smile:
FYI one of the features of Advent of Code is that we all get given different inputs so our answers will be different.
The examples are all the same but each of us gets different inputs for us to solve

Hmmmm...What does this stuff do?
ownerproof-975346-1669803213-faa472628fff
(im just joking see i erased last 3 bits)

Ooh! Is this like a daily game jam?

DONT POST THAT THAT IS USED TO PROVE YOU OWN YOUR ACCOUNT(which is important)

Day 1 - my solution

image

Snap! Build Your Own Blocks

Mmmm...Seems like a beginner stage c++ puzzle!
I'll do it in python.

Summary

a="""long string"""
a=a.split("\n\n")
a=list(map(lambda x:list(map(int,x.split("\n"))),a))
max(a)
a.sort()
sum(a[-3:])


TF WHO FLAGGED THIS ITS NOT INAPPROPIATE IN ANY REASON

:frowning:
I'm just used to python

Here's my solution.
I made a block but it works exactly like yours, Simon!

my Block

Hope I'll make it to the end this year, last year I gave up after day 5 or so :frowning:

nvm im too new to coding

Her's my solution
Part 1

Part 2

And here's my project Snap! Build Your Own Blocks

uhhhhh.. huh?

Is the 4th elf not the correct answer??

My solution

Part 1

advent of code-2022-day1-part1
(I had forgotten the existence of the sum block! hahaha)

Part 2

advent of code-2022-day1-part2

project

can someone help me pls i dont understand this

edit: oh wait im stupid one sec dont help me

Summary

a=[long list of stuff]
for i in a:
c=list("XYZ").index(i[2])+1
if i in ["A Z","B X","C Y"]:
b+=c
elif i in ["A X","B Y","C Z"]:
b+=c+3
else:
b+=c+6
b
b=0
d=dict(zip(["A X","B X","C X","A Y", "B Y","C Y","A Z","B Z","C Z"],[3,1,2,4,5,6,8,9,7]))
for i in a:
b+=d[i]
b


Flaggers :rage:

ohhh my godddd i made the block but the day 1 input is soo longg the block takes so long to do it
and putting it in a warp lags it :(

Do want to show us your block - we could maybe see where the delay is occuring?

Remember to put it inside of a

Summary

This text will be hidden

So that only people who've already done it or are not taking part can look at it

one second

Summary

Snap! Build Your Own Blocks

the variable thats in there is the input

the block is a lot more complicated that yours, but thats because i really didnt know what to do lol

it finds the highest number, which is what it wants us to do, but the input hundreds of lines long it takes a very long time to do all of it

edit: wait, theres 2 parts to this puzzle?

Before trying to speed it up - I'd make sure that your code works for the test data (which I don't think it does at the moment)

Once, you've got it working for that - then move onto your real data

OH MY GOD IM DUMBB AHHHH

i didnt read the puzzle right :melting_face: