|
chutwig posted:On it! I'm always indecisive about whether I want to use these as opportunities to try to work with a new programming language or not. Usually I start with trying to write it in [Flavor Of The Week], bang my head on the desk for an hour, then give up and write it in Python in 5 minutes. Yeah, I enjoy little puzzles like these as I try to learn a new language. Currently fiddling with Perl 6, and just got my first two stars.
|
# ¿ Dec 5, 2015 01:18 |
|
|
# ¿ May 11, 2024 13:48 |
|
I've looked at it every which way but I'm clueless on how to go about solving Day 4. I have a basic gist of hexadecimals but I'm not understanding MD5 hashes and what is needed to solve the problem. Anyone able to break the problem down in a different way? *I'm trying to solve this using Perl 6. Hughmoris fucked around with this message at 01:51 on Dec 6, 2015 |
# ¿ Dec 6, 2015 01:49 |
|
chutwig posted:Here is how I solved it in Python: https://github.com/erhudy/adventofcode-solutions/blob/master/problem4.py Thanks for the tips. I'm going to take another look at it.
|
# ¿ Dec 6, 2015 17:12 |
|
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 |
|
|
# ¿ May 11, 2024 13:48 |
|
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 |