|
chutwig posted:Finally had time to return to the problems after a busy December and restart all the way back at problem 7. Having it laid bare that I'm a systems programmer with little knowledge of algorithms is teeth-gritting sometimes, but that makes it all the more gratifying when I get the solution. Welcome, you're gonna have a lot of fun (until Day 19, drat that day). But, I'm just curious, what does "systems programmer with little knowledge of algorithms" means? From what I know, systems programming still is programming (with a different focus), where algorithms are just as prevalent and as important (if not more so) than application programming.
|
# ? Dec 28, 2015 00:34 |
|
|
# ? May 13, 2024 10:49 |
|
Volguus posted:Welcome, you're gonna have a lot of fun (until Day 19, drat that day). But, I'm just curious, what does "systems programmer with little knowledge of algorithms" means? From what I know, systems programming still is programming (with a different focus), where algorithms are just as prevalent and as important (if not more so) than application programming. Sorry, I don't mean systems like low level C/assembly guy. I mean I'm the sysadmin who knows Python who winds up gluing other projects together for deployments, monitoring, that kind of stuff. Describing it as "systems programming" was not the right choice of words. chutwig fucked around with this message at 03:08 on Dec 28, 2015 |
# ? Dec 28, 2015 03:03 |
|
I just found this, I'm trying to day 4 in Haskell, but it's taking over ten minutes to do part one and it's only into the 41,000,000s for some reason. {-# LANGUAGE OverloadedStrings #-} import Crypto.Hash.MD5 as MD5 import Data.ByteString.Char8 () import Data.ByteString.Char8 as BS import Debug.Trace pickBy :: (a -> Bool) -> [a] -> a pickBy p (x:xs) | p x = x | otherwise = pickBy p xs pickBy _ [] = undefined main = do let input = "blahblah" let possible = Prelude.map (\n -> (BS.pack $ input ++ show n, n) ) [1..] let (_, n) = pickBy (\(str, n) -> traceShow n $ (BS.take 5 $ MD5.hash str) == "00000") possible print n
|
# ? Dec 29, 2015 07:03 |
|
The question is asking you to check the initial digits of the hexadecimal encoding of the hash output.
|
# ? Dec 29, 2015 08:20 |
|
So far this has been putting my reading comprehension skills to the test more than my coding skills.
|
# ? Dec 29, 2015 21:01 |
|
It's happening again! I didn't make the leaderboard on the first challenge but I'm going to try my speedy luck again tonight. This year I am aiming to solve in SQL to the extent possible. Problem 1 this year seems about as challenging as problem 2 last year -- will things prove twice as hard overall?
|
# ? Dec 1, 2016 20:31 |
|
Aww hell yeah - I might even have time to finish this year, heh
|
# ? Dec 1, 2016 21:50 |
|
I've been doing a few of the days that I never finished last year in anticipation of 2016 starting. Did last year's in Python, doing this year's in Go.
|
# ? Dec 1, 2016 22:13 |
|
Erwin posted:I've been doing a few of the days that I never finished last year in anticipation of 2016 starting. Did last year's in Python, doing this year's in Go. One guy did yesterday's challenge in brainf*ck: https://www.reddit.com/r/adventofcode/comments/5g1cx1/spoilers_2016_day_1_brainfck_dear_fsm_why_did_i/ Yea ... beat that.
|
# ? Dec 2, 2016 06:49 |
|
Volguus posted:One guy did yesterday's challenge in brainf*ck: https://www.reddit.com/r/adventofcode/comments/5g1cx1/spoilers_2016_day_1_brainfck_dear_fsm_why_did_i/ I just came up with Erwin's law: Given any online programming challenge and ample time, someone will solve it in brainfuck.
|
# ? Dec 2, 2016 15:41 |
|
Do you actually have to log in with one of the mentioned methods to get the second part of each day's puzzle? e: guess you have to log in to do any of it. whodatwhere fucked around with this message at 19:24 on Dec 2, 2016 |
# ? Dec 2, 2016 19:15 |
|
Been trying to learn Pandas for work. 2016 Problem #3 import pandas as pd Part 1: df = pd.read_csv('./data_A.txt', header=None, sep=r"\s+") df.values.sort() df.loc[(df[0] + df[1] > df[2])].count()[0] Part 2: df2 = df[0].append([df[1],df[2]]) df2_list = (list(df2.values)) new_groupings = [(x,y,z) for x, y, z in zip(*[iter(df2_list)]*3)] tf = pd.DataFrame(new_groupings) tf.values.sort() tf.loc[(tf[0] + tf[1] > tf[2])].count()[0] Hughmoris fucked around with this message at 02:08 on Dec 4, 2016 |
# ? Dec 4, 2016 01:16 |
|
Pandas for Problem #4: import pandas as pd from collections import Counter def top_five(x): d = dict(Counter(''.join(sorted(x)))) s = sorted(d.items(), key=lambda x: (-x[1], x[0])) return (''.join([i[0] for i in s[:5]])) df = pd.read_csv('./raw_data_4A.txt', names=["raw_strings"]) df["checksum"] = df["raw_strings"].str.extract('\[(\w+)\]') df["sectID"] = df["raw_strings"].str.extract('-(\d+)\[') df["string"] = df.raw_strings.str[:-11] df.drop('raw_strings', axis=1, inplace=True) df["string"] = df["string"].str.replace('-','') df.sectID = pd.to_numeric(df.sectID) df["top_five"] = df["string"].apply(top_five) df.loc[df.checksum == df.top_five]['sectID'].sum()
|
# ? Dec 4, 2016 09:29 |
|
Your Python/Pandas looks a bit like how it might look in R, with the data frame subsetting and filtering and whatnot. I did part 4 in postgresql; the translate function made the substitution cipher much less painful than I thought it would be at first: https://github.com/piratejon/toyproblems/blob/master/adventofcode/2016/04/04.sql
|
# ? Dec 4, 2016 16:40 |
|
Banging through this year's in Erlang: https://github.com/ctbaran/adventcode2016 And doing last year's in Haskell (read a ton of Haskell, written considerably less): https://github.com/ctbaran/adventcode2015 Check out my awful code (or don't ).
|
# ? Dec 5, 2016 04:08 |
|
I am Erlang-illiterate and hard pressed to understand your approaches by reading the code alone. I wonder if it will become more clear when the problems are more complex and have to be broken into smaller pieces.
|
# ? Dec 6, 2016 06:19 |
|
Getting the wrong answer for today's part 1, despite it working for the example case. Frustrating. edit: Because Im a sloppy moron. Got it. iSurrender fucked around with this message at 09:44 on Dec 6, 2016 |
# ? Dec 6, 2016 09:30 |
|
iSurrender posted:Getting the wrong answer for today's part 1, despite it working for the example case. Frustrating. Did you also hard code the string length to 6, without noticing it was 8 in the actual input?
|
# ? Dec 6, 2016 20:44 |
|
Pointsman posted:Banging through this year's in Erlang: https://github.com/ctbaran/adventcode2016 Good stuff. I've tried my hand at Haskell a couple of times but it just doesn't stick for me.
|
# ? Dec 7, 2016 04:17 |
|
I never finished last year's stuff, so luckily I have things to do after I finish this year's easy beginning puzzles! I inadvertently solved both parts of the Day 8 today when I made a visualizer to help debug the first part. My python solutions
|
# ? Dec 8, 2016 22:45 |
|
|
# ? May 13, 2024 10:49 |
|
Hughmoris posted:Good stuff. I've tried my hand at Haskell a couple of times but it just doesn't stick for me. It's alright, I'm bad at Haskell too. Here's a day 12 solution in Erlang using a zipper (just cause I felt like it), the data structure with the highest simplicity:cool ratio: https://github.com/ctbaran/adventcode2016/blob/master/ac12/ac12_1.erl
|
# ? Dec 13, 2016 02:48 |