It's December again, which means Advent of Code starts again. Advent of Code is "an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.". My teacher thought it would be nice if me and my classmates would solve problems as well, providing it has to be done in C++ (we are even getting points for solving them!). I'm curious whether other Cemetech members are trying these puzzles as well! Smile

Here are my solutions located: https://github.com/PeterTillema/AoE2018
I'll probably not bother when they get more difficult, but at least this first one is easy enough that it's a fun bite-size exercise.
Code:
#!/usr/bin/env python3
import sys
from collections import defaultdict
from itertools import cycle

a = 0
n = 0
hits = defaultdict(int, {0: 1})

for x in cycle(map(int, sys.stdin)):
    n += 1
    a += x
    hits[a] += 1
    if hits[a] == 2:
        print('Found', a, 'twice at index', n)
        break
Day 2 was even easier than Day 1:

Code:
#!/usr/bin/env python3
import sys
from collections import Counter

a = 0
b = 0
for l in sys.stdin:
    a += (2 in Counter(l).values())
    b += (3 in Counter(l).values())

print(a * b)
I'm solving each problem with Jelly for some reason, with the input file supplied on stdin. Solutions are timed with pypy.

Day 1 Part 1 (7 bytes, .4s):
Code:
ƈLпỴVS

Day 1 Part 2 (18 bytes, 8m18s):

Code:
ƈLпỴV©ṪLṙɼṛ/+ƲÐḶṾ

Day 2 Part 1 (16 bytes, .25s):

Code:
ƈLпỴĠẈ2,3e€Ʋ€SP

Day 2 Part 2 (19 bytes, .9s):

Code:
ƈƈ¹Ð¿ỴṖŒcZEƇḢ€Ɗ€LÐṀ

Day 3 Part 1 (55 bytes, 5m15s):

Code:
‘⁹Ѥ¦¶5ñ⁸p6ñ⁸¤ḅȷ¶+3ị⁹Ḷ+ị¶ẋȷ²¤¶ƈƈ¹Ð¿ỴṖ¹⁶eØD$?€Ḳ$€Vñƒ¢>1S

Day 3 Part 2 (46 bytes, [broken?]):

Code:
Ḋs2Ɗ€ZẎ€ṙ2<ɗ/Ạ¶ƈƈ¹Ð¿ỴṖ¹⁶eØD$?€Ḳ¹ƇVƲ€ŒcÇÐḟẎḢ€Æṃ

Day 4 Part 1 (84 bytes, 1.8s):

Code:
15ịñÞ@WŻ60¡ṭɗñƇ@?¶0ị=¶6ịr⁹Ḣ¤‘ṛ¦@⁹Ṫ¤ṭ¶6ị‘;¶ƈƈ¹Ð¿ỴṖṢ¹⁶eØD$?€Ḳ$€VL_20ṠƊŀ@ƒ⁸ṖS$ÐṀḢµṪ×M’$

Day 4 Part 2 (84 bytes, 1.8s):

Code:
15ịñÞ@WŻ60¡ṭɗñƇ@?¶0ị=¶6ịr⁹Ḣ¤‘ṛ¦@⁹Ṫ¤ṭ¶6ị‘;¶ƈƈ¹Ð¿ỴṖṢ¹⁶eØD$?€Ḳ$€VL_20ṠƊŀ@ƒ⁸ṖṀ$ÐṀḢµṪ×M’$

Day 5 Part 1 (11 bytes, 21s):

Code:
ɠṖ;ŒsṪ=ɗ?/L

Day 5 Part 2 (21 bytes, ∞d):

Code:
ɠ,`Œtḟ@Ṗ;ŒsṪ=ɗ?/ʋ€`ẈṂ

Day 5 Part 2 (22 bytes, 19m30s):

Code:
ɠQ,`Œtḟ@Ṗ;ŒsṪ=ɗ?/ʋ€¹ẈṂ

Day 7 Part 1 (39 bytes, .4s):

Code:
ṖZḟ/Ṃ©ṭṪṭn®Ḣ$Ƈ¶ƈƈ¹Ð¿Ỵf€ØAḊ€µZḟ@/ḢṭÇL’$¿

Day 10 Part 1 (67 bytes, 41s):

Code:
«/r»/
ƈƈ¹Ð¿ỴṖḲe”-ṭØD¤$Ƈ€¹ƇƊ€VUŒH€+\€,ÑṪẈƊ€⁼Ṣ$ɗ¿`_@/€µÇ,þ/e€€ị“# ”ZY

Day 10 Part 2 (51 bytes, 43s):

Code:
ƈƈ¹Ð¿ỴṖḲe”-ṭØD¤$Ƈ€¹ƇƊ€VUŒH€+\€,«/r»/ƊṪẈƊ€⁼Ṣ$ɗп`L_2

Day 11 Part 1 (31 bytes, 3.3s):

Code:
+⁵µ×⁹+³×µṚ3ị
300ñþ`S3Ƥ€S3ƤŒMḢUṾ

Day 11 Part 2 (38 bytes, 5m15):

Code:
+⁵µ×⁹+³×µṚ3ị_5
S⁹Ƥ€S⁹Ƥ
300µñþ`çⱮµŒMḢUṾ

Day 12 Part 1 (43 bytes, .3s):

Code:
ɠḲṪ,ƈƈ¹Ð¿ỴḊṖṢṪ€¤=”#UŻ$8¡ḄNịɗ5Ƥ⁹,ʋ/20¡ḢT_41S

Day 12 Part 2 (47 bytes, ∞y):

Code:
ɠḲṪ,ƈƈ¹Ð¿ỴḊṖṢṪ€¤=”#UŻ$8¡ḄNịɗ5Ƥ⁹,ʋ/5ȷ10¡ḢT_ȷ11’S

Day 12 Part 2 (71 bytes, .35s):

Code:
UŻ$8¡ḄNịɗ5Ƥ⁹Ñt0,
i1_3x2-ṭḊŻ+ɗɼṛ
®5ȷ10 1¦S
ɠḲṪ,ƈƈ¹Ð¿ỴḊṖṢṪ€¤=”#ñ/ÐLḢT+¢’S

Day 12 with number of iterations as input (43 bytes):

Code:
ɠḲṪ,ƈƈ¹Ð¿ỴḊṖṢṪ€¤=”#UŻ$8¡ḄNịɗ5Ƥ⁹,ʋ/¡ḢT_³Ḥ¤’S
So, apparently the contest is over, and I'm happy to say that I finished all the challenges! A few were incredible hard and I have to admit that https://reddit.com/r/adventofcode was my favourite place to be this month Very Happy I took a few ideas from Reddit and implemented, and once copied some C++ code and modified it a bit (because part b was too hard). Many puzzles were fun! I really enjoyed the Mine Cart challenge (13), and the Beverage Bandits (15) was nice as well. You can take a look at my solutions here, but please don't laugh at my horrible code Razz

All the challenges started at 6AM for me, so I didn't get on the leaderboard, but it was still fun solving these puzzles! Smile
It's AoC 2020 time!

Moved my Jelly solutions to Jelly 2020.
jacobly wrote:
It's AoC 2020 time!

I'm in! Anyone want to join the Cemetech private leaderboard? Join with code 387241-7e26eb8c Smile
I've been doing this year's in Rust, and recently got around to making a repo for it: https://github.com/commandblockguy/aoc2020
It's that time of the year again (although I probably should have said something prior to the first day, whoops). You can still join the leaderboard with the code above, if you want to participate.

This year, I'm doing it in Python, and trying for speed. I've made a project template + helper module that uses advent-of-code-data to automatically download my input file and submit the result of my code. It also checks my solution function against the example problem, and runs it on the actual input file only if it succeeds. In the future I may also try to get it to automatically scrape the example problem and expected solution from the webpage.
_appears from the internet grave as is tradition at this point_ we've been doing it in z80 assembly this year because its been ages since we've actually written any z80. feels good to be writing it again, and felt like a reasonable reason to poke in and say hi here again

repo for the year is at https://github.com/faithanalog/adventofcode2021

we're kinda "cheating" by not including the raw input data to parse on the calculator, just using some vim macros to modify it into something that's basically the same data but takes up less memory. because otherwise we'd have to like compress the data and then decompress it at launch so it'd fit in a ti83 program and thats just a pain
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement