« first day (2250 days earlier)      last day (2923 days later) » 

01:17
cbg
what's on the menu tonight
sleep-deprivation with a side of guilt
don't eat too much of that
I think I might actually be able to get back to day 9 part 2 tonight
compression?
01:23
yeah
I know what I want to do (I think)
:)
good luck with it if you do get back to it
😀 thanks
cbg
01:40
South Park is great
02:06
good night
night @AndrasDeak
I'm stumped.....
this is discouraging
day9-wise?
yeah part 2
I can't figure out the pattern from the examples
what kind of pattern?
I'm trying to work out how to determine the length without actually expanding the characters
and I'm trying to figure it out with this one: (25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN
02:08
ah:)
on paper
The previous examples are not helping me at all because they are too simple
that one has the real cases I want to deal with
Like, 25x3 stops here: (25x3)(3x3)ABC(2x3)XY(5x2)PQRST
I don't know what characters I should use for the decompression
or, do I handle the decompression on the inside first with that substring I have now?
in my interpretation, when you encounter a marker, it will suck in as many characters as it sees and decompress those
then you carry on
but wim will disagree
there are multiple ways to interpret the rules, but the actual inputs will be identical across interpretations
for example what happens with this: X(8x2)Z(3x3)ABCY
02:11
as I see it, it works like this: (25x3)[WHATEVER IS 25 CHARS]<rest> --> [WHATEVER IS 25 CHARS][WHATEVER IS 25 CHARS][WHATEVER IS 25 CHARS]<rest> --> ...
wait....even the chunks with the parentheses?
wat?
really?
view spoiler <-- step-by-step expansion of X(8x2)Z(3x3)ABCY according to my interpretation
good luck:)
rhubarb
rbrb
thanks
hey question: for bit in bits: \n if bit:<- when does "if bit" evaluate to true?
02:59
Cabbage
@alex That depends on what's in bits. Generally, anything that's not "false-ish" will evaluate to True in an if test (or other Boolean context). False-ish values include numeric values of 0 (so integer, float and complex zeros), and empty containers: the empty string, the empty list, tuple, dict, or set. If a container object contains anything, then it's true-ish, so if bit is the string "0" then if bit will be True
03:26
@wim I'm rather fond of this one: stackoverflow.com/questions/35132342/… for obvious reasons. :)
Feb 1 at 14:23, by PM 2Ring
I just quelled a comments battle by quoting the docs. :) But I must admit, the behaviour of os.path.join with absolute components is a little surprising if you don't know about it. http://stackoverflow.com/questions/35132342/python-unable-to-save-file-with-slas‌​h-in-front-of-name
DSM
DSM
commonprefix is my usual go-to as a function which does exactly what it says it does, but in a context where that's almost never going to be useful..
@DSM yeah, it's amazing how useless that can be
03:41
noob mistake, trying to troubleshoot now....maximum recursion blah blah
it's very silly this is giving me a hard time
I'm not happy
and the cases were not well explained...grumble
wim
wim
04:03
@AndrasDeak Which part do I allegedly disagree with? I didn't see anything wrong with what you wrote above ..
as long as the markers are taken one-by-one... you shouldn't expand a marker from within a recursion, because the markers can reach beyond their own window
And this is not just my "interpretation", it was confirmed by AoC author
DSM
DSM
FWIW in this context I don't given authorial intent much credit -- the text should speak.
=/ ....
grr
wim
wim
yeah, I agree there should have been an example to cover this case
glaring omission !
DSM
DSM
04:19
Okay, after today's chaos I'm calling it early. Rhubarb for all!
rbrb @DSM hope tomorrow is better
2 days ago, by PM 2Ring
After reading all the stuff in the transcript about unclear instructions for some of the recent AoC puzzles I'm kinda glad I decided not to participate. I hate ambiguous or otherwise poorly-specified problem descriptions.
It's starting to take me too long to do these
and I'm thinking that I'm maybe wasting my time now
Did you fix the max recursion problem?
just a few minutes ago, but it was so unsatisfying
04:32
That doesn't sound like fun.
haha, and I just ran one of the sample tests and it failed but I got the right answer
eff this
I just hope the problem description is on the shorter side this time
FWIW, caching can boost performance of recursive functions, but it depends on the nature of the recursion. If it has to re-compute sub-problems, definitely give caching a go. The simple way is to decorate with functools.lru_cache
interesting
Because I wanted to keep my original solution. I'm going to check that
Doing your own cache with a default arg dict will probably be faster, because decorators give you an extra level of function call, and because lru_cache tracks caching stats. OTOH, those stats can be useful to know, and it's nice to be able to limit the size of the cache if it would otherwise eat too much RAM.
04:40
I'm curious to see what happens if I do this with what was blowing up originally
wim
wim
04:57
AoC animation looks like Chicago with the L-train :)
I tried using memoization...my code must be really crap...because it's not helping. I think I'll just keep this solution
What's the fastest way to add a single point to a Matplotlib plot?
Because calling scatter is awfully slow for some reason
05:13
why didn't I do the A* ready
05:24
Switching to Python 3 ruined me on this one, lol -- my old implementation broke in several places and I had to update it
shitshitshit
pasted o90 :D
well that's not corectreally
128 :(
but I am at the airport :D
and at least I did A* from scratch
and checkin and security check after the puzzle was revealed
I really suck :d
wat, still too high?
wim
wim
phew ... harder than yesterday, but not as hard as the day before
05:40
hmm
I still get too high for part2
strange
it is rather low number already
and fast too
Hm. Is today's sample map supposed to match what you'd get?
@WayneWerner swap x and y :P
oh wait, I see
it is supposed to match with input 10
they have a sample of 10 as the favorite number
05:41
not your input
but I needed an x/y swap
now where is my problem in this damn part 2
flight is boarding soon!!!
including starting location
cool, wim is 91 on the leaderboard
wat
wat wat wat
why oh why
the number is much lower than what I get... I don't get it...
you're rushing now to beat the boarding
you're not thinking straight
silly ppl call simple BFS simple A*
wim
wim
where are you flying?
05:46
I am at least 100 greater
and it is not just off-by-one
shit flight is leaving
:(:(:(
wim
wim
I was 40-something earlier, but missed a few days due to Xmas holiday parties
marcus is on there too
@wim helsinki
wat the number is like half of what I get...
now at least I know the solution so I can fix it on board
were you just guessing numbers to get the star?
wim
wim
"Why did you miss your flight, Antti?"
"Well, I was stuck in a maze of twisty little cubicles..."
I'm surprised I'm still on the leaderboard -- about to fall off though, admittedly
wim
wim
05:51
we are tied at 888 on your private leaderboard
Wow, that's crazy
I'm wat a whopping 356
pew pew
Looks like Antti will surpass us both, though, once he finishes part 2
The way local score is computed on the private leaderboard
05:56
I wonder what I can be doing wrong here...
shit boarding is completed
crashing or wrong answer?
wrong, about twice the correct one
so...
wim
wim
how do you know it's twice if you don't know the answer
antti get on your plane..
well I guessed, but then I used an existing solution :D
I am on the plane
but i need to shut down the net :D
05:58
haha right
I just iterated over all (x,y) and did if dist(blahblah) <= 50: set.add((x,y)) etc etc etc
yes
that's what I am doing too
make sure you're taking into account invalid states and returning an appropriate value as well
wim
wim
used an existing solution??
man, don't cheat.. .that's not cool
I used my part1
it is twice as much :D
well... I have an idea...
perhaps our map didin't have negatives... ?
:P
:D
You got rank 245 on this star's leaderboard.
I suck at these search algorithms because I have never done them on Python...
and ... been ages since I needed to do them in any other language
06:09
I'm guessing full A* will be required at some point in a future question
wim
wim
I don't even know what A* is
no CS background here
I did A* for the first part
it was because I had a bug in the bfs.
I thought I need A*
my debugging skills suck
"why does my computer behave as if mouse button is stuck pressed"
"it is because the buckle is pressing the touchpad you idiot"
(I restarted X before I realized the real reason)
anw.
deicing completed I guess I need to stop now :D
@wim BFS = basic form of search that can also be thought of as Dijkstra's algorithm with all edge weights equal to 1, Dijkstra's algorithm = BFS that can take into account different edge costs, and A* algorithm = like Dijkstra's algorithm except it also uses a heuristic
I mean I didn't do A but BFS with Manhattan heuristics
but yeah it could be made into A* easily.
For instance one famous use of A* is solving the 15-puzzle
Which, now that I think about it, might be a good AoC candidate
wim
wim
07:06
hmmm
so what do you call my day 11 implementation, BFS or Dijkstra or A* ?
I just called it bfs but I don't know what you mean when you write about edge costs
07:23
@wim dijkstra finds the "least expensive path" to many nodes
a* is dijkstra + future nodes are prioritized by a heuristics value...
A* is an informed search algorithm, or a best-first search, meaning that it solves problems by searching among all possible paths to the solution (goal) for the one that incurs the smallest cost (least distance travelled, shortest time, etc.), and among these paths it first considers the ones that appear to lead most quickly to the solution.
and "For the algorithm to find the actual shortest path, the heuristic function must be admissible, meaning that it never overestimates the actual cost to get to the nearest goal node."
your algorithm is dijkstra with constant cost, a kind of BFS.
it is not A* because there is no priority queue
07:43
cabbage
08:05
Cabbage :'(
Chennai is devastated...
wim
wim
thanks
actually the same algorithm for day 11 worked for day 13
@thefourtheye The sad part is that the Chennai Singapore Trans Oceanic Cable has also suffered :/
One of my colleagues lost her house :'(
Ouch, That's really sad.
08:08
Few buses and vehicles were toppled
Most of the small shops need total makeover...
ah storm
Yup :(
I don't know why December has started hating Chennai
didn't make headlines in Finland yet, I expected something worse
Last year, Flood, this year Cyclone
confirmation bias
08:11
True. We need more samples
Errr, actually we don't need any more :-/
raycasting A*
cabbage
hey @thefourtheye
Hey @AndyK :-)
sup man? the cyclone is still ongoing?
Its over... Its just raining today...
08:19
350 kms away and still feeling it's effect :/
hey @BhargavRao
Hi @AndyK. :)
@thefourtheye I was talking to Bhargav the other day and he told me you were based in Chennai. I've got a team in Chennai but I don't know much about the do's and don't of Chennai. Would you have some link you can share by any chance or some advices...?
@AndyK Sure. What sort of things you are looking for?
@AndyK Hey, I've created a room for you. I've also invited you there! Let's take it there. :)
08:24
where's the url for the room @BhargavRao?
Can I ask a quick and stupid question? Or should that be done as a post to stackoverflow?
Python says that dir() without parameters does this: show the names in the module namespace
@Amposter shoot
what are 'names' though
other places defines names as functions and classes etc, but i dont see my classes. i see things like builtin , service and top (i'm using twisted)
basically, what should appear when i dir()?
cbg o/
08:41
@Amposter That's not quite correct: dir() without parameters shows the names in the current namespace. So if you call it inside a function, you'll get the names that are local to that function. To get the stuff that's global to your module you need to call it in the global context, i.e., outside a function.
@PM2Ring what are 'names'?
@Amposter names for namespaces
try to add locals() inside any functions of yours
and then do another function
@Amposter See Other languages have "variables", Python has "names". For a more in-depth treatment, see Facts and myths about Python names and values by SO veteran Ned Batchelder.
4
@AndyK @PM2Ring Thanks, I'll try that and check those links out
then add globals()
09:01
I see now yes, I was just confusing myself. Thanks :) @AndyK @PM2Ring
@thefourtheye I'm sad to hear about the cyclone devastation in Chennai. :~(
No worries, Amposter.
@PM2Ring Thanks man. Recovery works have started already. We should be back to normal in a week or so.
a week ... wow
no wonder I do not have emails from the team in Chennai ...
No power and no mobile networks are operating in most parts of the city :(
wow
09:18
Cabbage!
C'est la vie.
09:34
When I have to return a notebook because I am leaving the job, what is the best way to clean up the notebook without reinstalling the OS? Are there good tools? System recovery (if possible). Does this overwrite the data with zeros?
cccleaner
Thank you for that one ;) Will check it.
10:40
Why the input 'xx' is valid here, when i do '^'?
(.)([^\1])
cbg
@manuzi1 backreferences do not work inside character classes.
so it is "any character not followed by 1" or "any character not followed by U+0001" depending on did you use a raw string or not :D
ah sorry, it is \1 is always U+0001 in character class
>>> re.fullmatch(r'(.)([^\1])', '1\u0001')
>>> re.fullmatch(r'(.)([^\1])', '1\u0002')
<_sre.SRE_Match object; span=(0, 2), match='1\x02'>
>>> re.fullmatch(r'(.)([^\1])', '11')
<_sre.SRE_Match object; span=(0, 2), match='11'>
@AnttiHaapala ty :)
10:57
@manuzi1 Are you sure you need to blank it? Data on there is usually company property...
@RomanLuštrik It isn't my notebook and I am not leaving. It is a friends one. I meet him on Wed and I will ask him. I think the problem nowadays is, that it is hard to work with a notebook all the time and only have company property on it.
@manuzi1 Oh, that's a pickle if there's personal information on there.
ccleaner is a great program, and very versatile. At least, it was last time I used it. :)
What one could do is remove the personal information and fill the disk with some (non)random data.
11:37
morning-full-o-meetings cbg to you all
morning
11:55
9/11 happened just 2 days after T = Epoch + 1G seconds...
coincidence?!
or ... is it a conspiracy
WOOOOO
cabbage
I wrote a friggin a-star and it worked the first time
and I nailed part 2
completely makes up for the two hours I wasted
+1!
where is it? :D
sorry, I just realized that my enthusiastic post a few lines above is spoilery
could you please bin it, @Antti?
nah, not a spoiler
well, YMMV
but it's early, and I myself started with a BFS only to run out of memory:P
12:00
ah, that was a bad bfs.
@AndrasDeak wrong data structure :D
of course it was, I was just trying to get away with the most naive approach possible
yeah, I contempllating using something like that
but my algo was so slow anyway, that even with enough memory it would've taken hours to finish
I am going to do a generalized version...
so I decided to just rehash it
@AndrasDeak there was something really wrong with your bfs
because this algo does still inspect a substantial portion of the nodes :D
so you weren't memoizing visited nodes
@wim I might have lost track of who believes what:D My impression was that our interpretation of the rules is different (then again, for valid inputs, it shouldn't matter)
@AnttiHaapala I was
it might just be due to juggling lists of tuples around...
anyway, I'm happy with my kludge-from-wikipedia answer:D
even if it's godsawful, the fact that it gave the correct answer for first run warms my heart
12:06
yea, it isn't wrong, except for sorted.
oh, right, I was going to write a loop for that, then got lazy:D
but yeah, that's insanely unnecessary
12:20
@AnttiHaapala (late reply) writing "best-first search" in a path finding context doesn't help at all to alleviate the BFS conundrum:D
I'm very happy with my part 2
rhubarb for a while, walking the dog
@AndrasDeak yeah, stupid me, I meant wim's code was Breadth-FS
:)
best friend search, the true purpose of life
BFFS
and yours looks like proper A*.
I wish there was a heap-queue class in Python :D
because that is now a PITA to use...
12:27
0
Q: Python module for longlong types

markSxI'm trying to make a int64_t module for python because python doesn't have a long long type. I found one in ctypes but I can't use it. So, I have embedded an intro in my application so the best way is to create a module that returns int64_t from c++. PyObject *Py_int64_t(PyObject *poSelf, PyObje...

Hi y'all, I have a question about Tuples: dpaste.de/Uapp It's explained in the link.
a = [(0,2,3), (0,2,5), (0,2,7)]
b = [(0,2,5), (0,2,8), (0,2,9)]
c = [v[2]-u[2] for u,v in zip(a,b)]
print(c)
#output
[2, 3, 2]
Thank you so much this worked!
12:43
@Emre Wouldn't it be easier to post a question to the main site? :)
@Ramy Numpy has 64 bit integers, both signed and unsigned. But if this is just for pure Python what's the point? As Mark Ransom says in the comment, Python has arbitrary precision integers, and if you need to restrict them to 64 bits that's easy enough to do using an appropriate bit mask.
OTOH, the way Python handles the sign can be a little annoying when doing bitwise operations on fixed-width numbers, but that's only a minor annoyance, and it's easily dealt with.
@RomanLuštrik It was only a little question, so it's ok here. I'd feel guilty winning rep for something that simple. :)
And if you posted it on the main site it'd probably get 5 answers in 5 minutes before someone dupe-hammered it. :)
@RomanLuštrik I would downvote and vote to close, so please no
@AnttiHaapala it's supposed to be...
@PM2Ring did you see a question I didn't?:D
@PM2Ring @AndrasDeak ':D
@AndrasDeak No, I'm just letting Ramy know that he can use Numpy if he really wants pure 64 bit ints in Python.
I think Emre took the best course of action:) Including greeting and a clear question rather than a mere link to a post on SO.
12:55
based on what logic (0,2,7) - (0,2,9) would give (2, 3, 2) ?
@marxin it wouldn't
Im asking op
because he probably forgot to include algorithm
then you should direct your message at them
12:56
Yeah Andras, I thought this was the best way aswell. Was just a small question which probably 90% of you could answer. I'm still a beginner.

« first day (2250 days earlier)      last day (2923 days later) »