« first day (2606 days earlier)      last day (2567 days later) » 

DSM
DSM
00:00
@wim: as soon as I saw it I remembered this from long ago
 
3 hours later…
02:44
I'm back and setting up for aoc day 4
03:06
what does set up include.. ramen + rockstar?
03:26
terminal 1 ruby day4 input terminal 2 with vim open
04:13
cabbage
04:25
@Unihedron pycharm
05:04
Blah I got back to my hotel room 2 minutes too late :(
oh well lol
double punch!
so difficult to read :F
Would have had sub-1 minute on this one too
1m29 :/
this one felt a lot like a CoC too
05:10
yeah, "given list count valid criterias" is common on CG
and really easy when you're used to abusing hash tables
;) ;) ;)
I missed the start and it took way too long to actually read the question
wim
wim
lamest question ever in an AoC
yea it was a bit on the too-easy side
considering how fast the leaderboard filled up, too
wim
wim
@Unihedron haskell ?
ruby
I was writing the code as I read the question
wim
wim
05:21
oh ruby
this code looks like crap
wim
wim
how can you even read that language
There was a 2015 problem where they linked a youtube video in a part2 in a way thst made it seem important but it was irrelevant and you only needed to change 40 to 50
how to write perl in ruby:D
so I knew not to fall into overreading traps
wim
wim
05:22
@AnttiHaapala don't do combinations
@wim why not?
wim
wim
you should only need to sort each word once
ah yeah that :P
it is 7:23 AM here :f
wim
wim
not sure what's uglier ... a bad algorithm, or one letter variable ruby vomit ...
HAHA
.uniq and .group_by are quick hacks to immediately rinse sets with a hash map
05:25
argh unhashable list :F
@wim fixed
wim
wim
I guess that was every man and his dog's solution
don't code dump here though, put it on github
tbh didn't even read part 2 fully, just saw "anagrams" and assumed
why not do << input.txt in terminal?
wim
wim
@Unihedron why are you on the room 6 leaderboard? I kind of assumed it's for the Python room ..
isn't there a ruby board?
I use python / js after the problems get hard
05:29
it is room6 board, morgan uses F#
any lang is fair game imo
ruby is the only tool that lets me utilize my typing speed to the fullest, while I don't have to think. past a point ruby is a liability
how fast you type normally?
not enough to be #1
also I don't think ruby room is doing Aoc. Java is my home (as you can see from my chat profile if you care enough to stalk) but I don't think they care either
ZOMG... try putting a 3 year old and 4 year old to bed at 9 pm while doing this... impossible!!!
05:33
I'll gladly trade my top 5 and top 10 scores for a happy family and life :thinking:
My wife has no sympathy for AoC... off to do dishes. rbrb
@Unihedron by the time the leaderboard is at 100, the java programmer has just finished writing public static void main(String[] argv)
Yeah... I'm not giving it up anytime soon (-:
@AnttiHaapala Hmm :) I'd say the Java programmer might not even have interpreted the question yet, but that might be a bit harsh ;)
wim
wim
lol ... I was waiting for the java joke
05:36
Oct 13 '16 at 17:58, by Antti Haapala
Sep 16 at 13:58, by Antti Haapala
Thanks folks, I'll be here all week month year decade probably too long.
I think the only thing that gives Java programmers an edge in a competitive environment over regular competitors is it's SO DAMN VERBOSE you can't realistically even write code outside an ide and supreme mastery of autofills like alt+enter, alt+space, keybinds and huge bars of sanity to spawn code like magic spells left and right and craft together what would be unearthly with determined, practiced moves without thinking
That java programmer would be DESTROYING the problem, while we are merely trying to solve
I am using IDE too
not me though, I use vim
is using IDE suddenly controversial?
that said, I still wouldn't have beaten the other four of you... well probably. I assumed the second part was checking for view spoiler
05:37
no, mastering autocomplete keybinds would be
wim
wim
I use an IDE for real work
I am using wim's aocd to fetch the input
wim
wim
sublimetext for AoC though
and I've got templates for all days too
wim
wim
I was surprised that aocd worked again this year without any code change needed
05:38
I can just concentrate on reading the question
in a big project, it gets difficult to keep track of everything. I use pycharm
:D
@piRSquared rip. It does take risks to guess yeah, but I copy-pasted the description and read it while I typed
it helps me verify that I guessed correctly, which was vital to my top 5 strike today
ah yeah that too
yeah, great job on that (-: seriously rbrb...dishes are waiting
now I remember, I used to have the task in Pycharm, in a browser window
05:39
take care of your dishes, I can wait :)
wim
wim
do you ever find that this poor coding style comes back to bite you in non-trivial questions?
I can imagine being 30 mins into some difficult tree traversal problem and forgetting what s meant
always
I don't code poorly when I need to not code poorly. When I'm in a competitive environment, I'm using the battlefield logic: Hope that what I need will arrive and give clear signal. For example, if I need to build a search that I might need to tweak, I won't pack it tightly into many lines.
If I need to find the function, it shouldn't be 1-char.
If I don't need to find it however, it's fair game. get in get out go back if we absolutely must
[tag: favor-pls] Can someone do me a favor and play 3rd party cop and link what to do when someone answers... stackoverflow.com/a/47614033/2336654
@wim Haven't looked into it but does your aocd data-fetch thing also work for non-file inputs? e.g. "your code is FOOBAR101" etc
05:41
day/X/input returns even if it's already inlined in the page itself
the link isn't there but you can still fetch from it
@piRSquared on it
Huh, so it does -- neat
wim
wim
@MarcusAndrews yep
05:47
huh, does it also handle caching the input file?
wim
wim
yeah
It's a good idea to implement something like that, very handy. I've just been doing a bash script to fetch the file 2 seconds after it opens.
It takes me more than 2 seconds to code, so that's a lot of bang for my buck.
I like my parser class :D
wim
wim
yeah you put in a lot of extra magic
I can copy-paste text from the example and replace the changing parts with <> or even a regex... and it will throw if the input doesn't match
I am really not sharp at all at 7 :F
05:55
Don't blame yourself, it's 2 pm here, that's why I'm still standing
d = Data("""\
foo bar
foob baz""")

for (x,) in d.parsed('foo <>'):
    print(x)
this will raise: ValueError: The pattern didn't match foob baz
Hmm, I'd suggest implementing more format features like SQL's _ and % to make it easier to ignore unneeded stuff
if the input is "The distance from XXX to XXX is = XXX" then I might just want to write "% from <> to <> %= <>" instead of the whole thing
Is there a sopython leaderboard for aoc?
@Unihedron on the contrary! I copy paste it.
@ReblochonMasque picard.png. Look at the starboard
wim
wim
The starboard, on the the starboard side of the page. With all the stars.
06:07
hmm, maybe it's just me, but copy-pasting comes with quite some penalty because there aren't many keyboard shortcuts to select text in my browser. I only do it when I'm in doubt
in every language I use, I make it really easy to pull up the regex engine :)
@Unihedron I did it exactly because
.+\d+$ etc
oh this one was easy to parse
hmm
exactly... after you realized that there is something like output
No, I was just looking for (\d+) thinking those are the bot numbers :D
06:10
Thank you @AnttiHaapala & @wim - joined
@ReblochonMasque are you the mr Anonymouse
... except marcus removed his acco
@wim hmm...I don't have any stars on that one...I know I did some of them
yes, I am.
maybe I logged in with my Google account instead of GitHub like I did this year...
06:13
@ReblochonMasque :D well,
wim
wim
@AnttiHaapala well of course he did (removed) is Marcus' middle name
@AnttiHaapala That was a cool problem
One of the few ones where it was good to use OOP
@AnttiHaapala thx... made me laugh tho. They responded with 'I accepted them'?! Oh well (-:
06:41
@Unihedron so for problem 10 after the errors I decided to write the parser, so that the fixed one read
value = Parser('value <int> goes to bot <int>')
gives = Parser('bot <int> gives low to <str:output|bot> <int>'
               ' and high to <str:output|bot> <int>')
sweet!
I think I might do something like that myself. so far I have almost nothing prepared and I don't feel that good about it :)
I started keeping a super simple blog on my adventofcode adventure. github.com/Unihedro/workout/blob/master/adventofcode2017/…
quite a few more active answerers on this years leaderboard
Yeah I tanked my old acct IIRC
Today's AOC was ridiculous.
I could have nailed the board had I been up at ridiculous-middle-of-the-night-oclock.
sum(len(set(words)) == len(words) for phrase in inputs for words in (phrase.split(),))
That takes about 10 seconds to write out and run? Add in {tuple(sorted(w)) for w in words} to get the second answer.
@AnttiHaapala man, I know those roads!
well, the tractor driver probably quite didn't :D
What is funny is that we all know that the timing is a huge driver of the "scoring" and that it is ridiculous. But what gets us (read me) upset is that I want to be at the top anyway (-: Just an innate desire to be at the top of the board
With most open contests online the problem is choosing a good start time due to so many time zones there are across the major tech hubs (US, india, ...). I think using midnight is a harsh but solid idea in that it removes a lot of people who aren't willing to stay up late so the playing field is narrower. Otherwise the board might be filled in ~30 seconds instead of ~3 min...
it would be better to randomize the starting time...
07:58
but you could game it by leaking the question
each puzzle would be announced right after the previous one starts, but at least 3 hours after, and on the same day according to some calendar.
or randomize it within the UTC day
Yeah, because a regular sleep schedule takes 3 days to establish and we should force many productive people to become unproductive in order to compete in a festive event. :D
Why? the timing is perfect! :D
08:14
At PE we stagger the release times
Not a perfect system but gives people a better shot once in a while
I just started doing PE... lots of fun!
cbg
cbg @AndyK
@piRSquared hey @piRSquared, who's tricks (= howdy's)?
I have to admit, I don't know what you mean by "who's tricks (= howdy's)?" And I want to... which is why I'm telling you I don't (-:
08:46
@piRSquared I meant how's tricks? It the London version of What's up or Howdy
Ahh, I'll use that on my friends at work in our london office. And allow them to laugh at me for trying to use it (-:
@piRSquared if they are real londoners, it should work like a treat
Ok good, because if I don't the illicit the response I want, I'll just accuse them of not being real londoners.
Cabbage
@piRSquared loool
08:59
I didn't realise that Americans don't use "How's tricks?". Outside of the USA we get exposed to American English from an early age via TV, movies, and popular music, so we tend to be aware of the expressions Americans use that aren't in British or Commonwealth English, but it's not easy to notice the expressions that they don't use.
:P
In Finland a common Urban dictionary material is a phrase which Google Translate translates to "How's it hanging", but it is not quite correct...
I just answered a question about global options affecting the formatting of floats. stackoverflow.com/questions/47628172/… I'm pretty sure such a thing doesn't exist. :) I wonder if it's ever been proposed?
rbrb everyone
09:35
@PM2Ring When I saw the question, I wondered the same thing - I think it would be useful.
09:46
Cabbage!
May I tell you where you may stick your global state?!
@PM2Ring döner
10:22
Hey all! Is this the main Python room? Just double checking!
yes
I think you meant __main__ :P
haha :P Well I'm new to Python and hoping to get much better. Is this the appropriate place to ask questions?
Yes, but please take a minute to read the room rules before you ask
because pythonic approach is EAFP
I would just ask
10:40
hey guys
Thank you for the link, Rawing. I appreciate it.
@Vamsi cbg
@elitecheese1337 btw such links are usually in the room info above the starboard (right side just above the starboard)
cabbage
took me 5 minutes to debug a problem that was actually me not copying the full input to my ipython session
that's where laziness will get you
11:03
I use underscore instead of camel_casing
TypeError: unhashable type: 'list' <<<< I get this error. I have a dictionary with keys and values, and I am trying to switch the keys and values in the lists.
only hashable types can be used as dict keys
@elitecheese1337 what marxin said. You can use tuples instead of lists
you can cast your lists to tuple and use them as keys
but tuples are not mutable so its a drawback
kind of the point for dicts :P
11:08
(you cant edit them after they;ve got created)
How can I use tuples instead of dicts? Sorry if that sounds, dumb, still pretty new.
google "python convert list to tuple"
Ok
Let's say I have this: {'Jay Pritchett': ['Claire Dunphy']}
I want it to be: {'Pritchett': ['Jay'], 'Dunphy': ['Claire']}
a = {1: [1,2,3]}
b = {tuple(v): k for k, v in a.items()}
this is what you can do
Would converting list to tuple by good for my case?
11:10
@elitecheese1337 There is nothing in your result that is a tuple.
I'll pass
I'm not sure if you can call that "switch keys and values"...
Right, that's why I'm confused why I would need to convert to a tuple. Because my expected result doesn't have a tuple.
What would you call that?
Your transformation is actually very unclear in what it does.
very very
11:13
That's more like splitting each string in the dict into a key and a value
come back with a proper MCVE
Why are both the key and its value converted into separate dictionary items?
Why is the value even a list in the original dictionary?
What is the relationship between those names?
Can there be multiple items in the list of the source?
Can there be multiple items in the list in the result?
What happens with persons that have more than two names?
What happens when there are two sisters with the same last name in the original dictionary?
… and so on. There are lots of open questions you need to be able to answer before you can solve your problem (whatever that problem actually is)
Sorry about that.
no worries dude, but seriously your transformation is quite strange, there is no obvious logic behind it, its difficult to imagine in what scenario you would need to do something like that
11:20
Return a "last name to first names" dictionary based on the given "person to friends" dictionary. The returned dictionary should contain every person whose name appears in the given dictionary (as a key or in a value list). The keys in the returned dictionary should be the last names of people in the given dictionary.
(Remember: every person has exactly one last name.) The values are lists of the first names (in alphabetical order) of people with a given last name. Names in the list should be unique: no one should be listed more than once. Use the list method sort to put the lists of first names into alphabetical order.
These were the instructions that were given.
What a terrible task
Anyway:
no spoilers :P
Does that test case I posted earlier make sense now?
11:24
yeah
personToFriends =  {'Jay Pritchett': ['Claire Dunphy']}

names = set()
for person, friends in personToFriends:
    names.add(person)
    for name in friends:
        names.add(name)

result = dict([name.rsplit(' ', 1)[::-1] for name in names])
8
Q: Happy Birthday, Finland!

Antti29Introduction As is known, in 2017, Finland celebrates its 100 years of independence. To mark the occasion, it is your job to produce a Finnish flag for everyone's enjoyment. Challenge Create a program or a function that produces the flag of Finland (the grey border is there for presentation pu...

Let's say I have this: {'Jay Pritchett': ['Taylor Pritchett', 'Bob Dylan'], 'Michael Jackson': ['George Pritchett'], 'Josh Hugh': ['Dev Pritchett']}
Would that code cover this test case, @poke?
Yes
But I did a mistake up there. That for loop should be for person, friends in personToFriends.items():
Alright, thank you! Appreciate it. By the way, funny thing is, a post of yours from two years ago also helped me recently haha :P
11:30
@elitecheese1337 can't you even try the full solution given to your homework?
Heh, chances are somewhat high nowadays ;P
@AndrasDeak What do you mean?
Please try to understand the code above though. If you have questions, feel free to ask about it.
what do you mean what do I mean?
@AndrasDeak This would be a fun game.
11:31
@poke values are not lists in your case
he need lists
poke: <code>
ecleet: does that code work for <input>
adeak: ??????
also, there can be multiple first names I'd assume
:P
@marxin fair enough, I’ll leave that as an exercise for the reader… *rolls eyes*
yeah
@AndrasDeak Oh you're right, sorry. I did try, actually. I'm just not very confident...I know, it's weird.
11:32
no, it's not weird, it's off-putting
You're right.
better write in on your own, you will have more satisfaction
if you can't even test whether full code solutions solve your problem, there's little hope for you in this course
so get your act together :P
@poke
@poke when I do test out the example I posted, I get this result: <function get_families at 0x11206fea0>
That doesn’t make any sense considering that I didn’t write a get_families function?
11:38
maybe you did but then forgot
time flows inexplicably in garlic space
Sorry, I included it, but if I take it out, I don't get any result after I enter the example
try actually calling your function with some inputs
I did, like {'Jay Pritchett': ['Taylor Pritchett', 'Bob Dylan'], 'Michael Jackson': ['George Pritchett'], 'Josh Hugh': ['Dev Pritchett']}
that's not a function call
you would need to learn some python basics before unfortunately
11:40
^
I am calling it with my function get_families
yes, that's also not a function call
And when I return it, I got "<function get_families at 0x11206fea0>"
I could help you but then we'd go on with this in the next basic step where you're stuck...
is this a generic python programming course?
11:42
that sucks
you're defining functions on your own, so I assume you've already covered functions...so go back and read how function definitions and calls work
concentrate on the parentheses
Putting your arguments within the parentheses is calling the function, no?
yes, but you haven't demonstrated anything like that and your result is consistent with this
Ok, well I got it to work actually, but the result is conrrect.
incorrect***
that's fine, you're on to your next bug
repeat this step until the code works
at this point you have to understand what poke's code is doing in order to find what's wrong with it
ending up with a full working answer to your homework step-by-step is pretty likely beyond the scope of this chatroom
if you have specific difficulties feel free to ask, but we won't hold your hand from start to finish
I understand. Would you mind explaining to me what it means?
11:47
what's "it"?
poke's code. :p
yes, I would mind
lol you're funny
17 mins ago, by poke
Please try to understand the code above though. If you have questions, feel free to ask about it.
“How does it work” is not a valid question.
good luck
11:50
Thank you. I'm just wondering what kinds of questions I am allowed to ask.
You can ask whatever you want, but you’ll likely not receive answers or even sympathy if you show that you don’t bother to try doing the work yourself.
the kind that demonstrates an eager effort to learn and to solve your problem on your own with some help, rather than wanting to suck the life out of everyone and making them do your work for you
I really did try to work on this question, which is why I asked about the original error in the first place.
I should've posted my original work in the beginning. Sorry for the third time.
you need to keep working
I guess I'll come back another time after I try to figure this out.
11:52
you got huge help from poke, but then you should keep working by understanding the code
Do you guys have any great resources on how to learn Python? And any tips in general? It would be greatly appreciated.
Yes, thanks you all.
@AndrasDeak would you say that is a good resource for beginners to programming in general?
I'm skimming through it and it seems like it requires somewhat of a previous knowledge in programming.
Nevermind, skimmed through more.
Anyway, thanks once again. I'll come back again another time. Sorry if I ruined anyone's mood, it really wasn't my intention. Hope you all have a blessed day.
no worries
good luck :)
Thank you. :) See ya!
12:07
@elitecheese1337 nah, it's fine. I'm just trying to push you so that we're all happier in the long run ;)
take care
12:21
cbg, friends.
So I've been playing with defaultdict. It really cleaned up a lot of set comparator code I had.
useful little thing
@JGrindal you haven't been here since Thursday, so: don't forget to join us in Advent of Code in case that's your cup of tea :)
@AndrasDeak I probably will later this week. I have to get a paper done or I'll miss submission deadline. It's occupied all my time.
@JGrindal Can you show us a small example? FWIW, I rarely use defaultdict.
12:32
real life interfering with online existence again; what a shame
    def gen_constraints(self, variables):
        """
        Generate a list of constraints based on the coordinate intersection of the provided variables
        :param variables: List of variables to be evaluated for intersection
        :return: List of constraints in the form of [((variable, position),(variable, position)), ... ]
        """
        intersections = defaultdict(list)
        for variable in variables:
            for i, space in enumerate(variable.spaces):
                intersections[space].append((variable, i))
@PM2Ring Basically, this is for solving a constraint satisfaction problem where I need to generate a list of where my variables intersect.
My alternative was.... not pretty.
@AndrasDeak don't remind me about how I haven't started this yet :P
sunday task was interesting
@JGrindal That seems like a reasonable algorithm.
meh, I mostly have fun by solving the challenges rather than competing (time zones and illnesses partly to blame)
12:41
@PM2Ring I concur.
Yeah I just try to take it as a learning experience and I wanted to make it through most of them this year. I'm just off to a bad start
Personally, I'd probably just use a plain dict and the .setdefault method, since the default in your case is just a simple list. OTOH, using defaultdict is probably slightly more readable.
Here's a short example of using .setdefault:
d = {}
for i in range(12):
    k = i % 4
    d.setdefault(k, []).append(i)
print(d)
# output
{0: [0, 4, 8], 1: [1, 5, 9], 2: [2, 6, 10], 3: [3, 7, 11]}
I'd say most of the time a defaultdict has something as simple as that passed to it
If you guys fancy it, there is a free Python Machine Learning book to claim here packtpub.com/packt/offers/free-learning
Indeed, and that's why I rarely see the need for it. ;) OTOH, that .setdefault trick isn't so good for sets, since there isn't a simple empty set literal. Of course, you could define an empty list outside the loop, but if you're going to do that, you might as well just use defaultdict(set)
12:53
@PM2Ring That option is also more elegant than my original for-loops-nesting-in-for-loops-until-you-want-to-die solution.

« first day (2606 days earlier)      last day (2567 days later) »