« first day (2258 days earlier)      last day (2915 days later) » 

20:00
O(whatever)
Haven't stress-tested it or anything
Or is it so that I was just stupid to table my reverse rotate incorrectly
I also changed one of the rules slightly
Instead of that 4 rule I made it len(num)//2
Since that rule only exists because the input is length 8
and is present to account for letters that appear in the second half of the string
20:01
I implemented the inverse of "rotate by letter" in the laziest possible way: get all possible rotations of the string, then discard all the ones that don't evaluate to the string after a "rotate by letter" command.
@MarcusS shit.
Couldn't be bothered to figure out its actual behavior
because I did it the stupidest way. I calculated a table of rotated offsets to originals
which means that the one offset that was ambiguous mapped to the positions that were at the beginning of a string...
and that wasn't in the table (naturally) when another rotate was needed.
I should probably stress-test my code actually, ensure that descramble(scramble(input)) == input or w/e
I had some other problem and I was like ffffuuu and the starboard was full, so I decided to go for p.
20:04
Didn't try odd-length strings much yet
I mean, I had an actual key error trying to descramble my input
I was really shocked at the leaderboards yesterday
I was at rank 36 on part 1, and went clear up to rank 6 on part 2 after cheesing it with permutation brute-force
Most of the top guys in part 2 were also top in part 1
20:05
So most of the 12-35 rank crowd for part 1, for whatever reason, either tried part 2 the hard way, or didn't have immediate access to a quick permutation implementation in their language of choice
quite a many people tried to do the reverse op first I get.
see also wim's ranking
I'm 90% salty that I'm lower in the private leaderboard than certain user(s) that have fewer stars than me
parsing errors etc, not in top 100 in part 1
Basically the coding equivalent of "this isn't even my final form"
@Kevin And the other 10%?
20:08
Salty over Firefly's premature cancellation.
wim
wim
I don't understand the "local score"
> If you add or remove users, the points will be recalculated, and the order can change.
^ sounds weird and stupid
@wim why?
wim
wim
why should adding or removing users change the ranking of other users
that makes no sense for any reasonable measure
wat?
the local score is based on who got the star first
@wim That's to prevent people from removing users and messing up the relative scores for people who solve after that
Imagine if I added 10000 dummy users, solved a question, then deleted them all from the leaderboard
20:12
if there are N people on the list, the first person to get a certain star gets N points and last person gets 1.
yeah
wim
wim
I think a better measure would be stars, with ties broken by total solve time (lowest first is best)
then these scores for each star are added together
but it isn't good
wim
wim
yep
it's better than what "stars" currently does
because a star in 10 minutes for day 1 isn't a match for star in 10 minutes for day 11
20:14
Suppose Alice has 100 + 98 = 198 points for posting her day 1 and 2 solutions first and third respectively. Suppose Bob has 99 + 99 = 198 points for posting his day 1 and 2 solutions second and second respectively. Suppose Carol joins the leaderboard. Her day 1 solution was submitted after Alice's and before Bob's, and her day 2 solution was submitted after both of them. Bob's score is recalculated to 98+99 = 197. Previously he was tied with Alice, and now he is behind by one point.
@AndrasDeak Thanks.
Guys any suggestion with this question stackoverflow.com/questions/41210126/…
@wim so one user who always solves each puzzle in 1 hour should be ranked before one user who solves each puzzle in 5 minutes but missed one puzzle due to their wedding on a certain day, and finished it 24 hours later...
but then we get back to the timezone conundrum
20:18
pfft
@kingmakerking I don't know much about dataframes but you might get a warmer reception if you fix the "Pyhton" and "fileds" typos in the title. Gotta make a good first impression :-)
if you care for AoC you will change your sleeping patterns.
right:P
@AndrasDeak no one tells you you need to stay awake until 6AM...
you can sleep until 5:45
right :P
A circadian rhythm /sɜːrˈkeɪdiən/ is any biological process that displays an endogenous, entrainable oscillation of about 24 hours. These 24-hour rhythms are driven by a circadian clock, and they have been widely observed in plants, animals, fungi, and cyanobacteria. The term circadian comes from the Latin circa, meaning "around" (or "approximately"), and diēm, meaning "day". The formal study of biological temporal rhythms, such as daily, tidal, weekly, seasonal, and annual rhythms, is called chronobiology. Processes with 24-hour oscillations are more generally called diurnal rhythms; strictly...
wim
wim
20:19
Probably "global score" is still the best ordering for the local leaderboard
that's what I do, go to sleep earlier than I used to, and wake up at 6:45 exact.
it is also good for my day rhythm otherwise
I have a night rhythm
At the end of the day, isn't it just for fun? :P
wim
wim
It shows marcus kicking everyone elses butt's , which is the closest reflection of reality
but I don't have a strong conviction for AoC anyway
20:20
@Kevin Thanks @Kevin I corrected it!
wim
wim
and it leaves salty Kevin below vaultah, as an added boonus
so salty
wim
wim
davidism still has a hole on day 11 ... n00b
a hole in one-one
I am not going to beat marcus :D
what, 800 points max remaining
~300-400 realistically
20:22
I'm half-tempted to put a little bounty on this post, but it's a risky proposition given it's got four close votes... Meh, tis the season
wim
wim
IIRC bountied questions are protected from closure
yup
need a mod flag with a convincing reason
@Programmer Yeah, I was just about to say. But I guess some people have fun by being competitive :-)
it has to be blatantly off-topic
Ok, cool.
wim
wim
20:25
maybe there is a secret hat for putting a bounty on blatantly off-topic question
I scrolled through the post and it contains things that look like json and python, so I assume it isn't blatantly off-topic. Mission accomplished.
@wim I wouldn't be surprised, some hats are always disruptive shit
This is approximately the fifth bounty I've levied and I have no memory of ever actually awarding any of the other ones. I hope whoever got automatically awarded them deserved it.
that only happens if there's a post with at least n score (n=3? 4?)
and only half of the bounty value gets assigned
otherwise it fizzles into nonexistence
wim
wim
why did you bounty that question
20:29
'tis the season
or he wants a hat
Because OP edited their post in response to my suggestion, which automatically makes me like them
or too much early eggnog
Responding positively to criticism in under a minute is a rare precious thing
or 'tis the season to have too much eggnog in a hat
@Kevin Wow! Thanks a lot for the amazing Christmas present!
20:34
Best of luck finding more answers :-)
If anyone wants to generate their own inputs for day 21: generator
is day 11 the hardest day so far?
I haven't had any time to go back to AoC at all
depends on yes
yeah
Yes.
20:41
"Sundays are hard" were disproved; maybe "day n*11" will be true, we'll see tomorrow
with the week I have, I don't know if I'll come close to catching up at all
if I really care about finishing. It will be after the 25th
does it still count? :P
Yes.
The limitations of Christmas Spirit exist only in the mind. You could finish AoC 2015 a week from now and it would still count.
DSM
DSM
Am I too late to agree that day 11 is the hardest?
not at all.
The limitations of frustrations about day 11 exist only in the mind.
20:43
The Tao of Kevin
Would it be a terrible idea to throw all my stuff in the main folder?
(right now I have everything split out into folders per day)
I have that too, because I have unit tests set up
so I have them organized per day
Yeah, I want to set up a unit test for 21
inside each day I have each part
DSM
DSM
This is why I dare not show my solutions. unit tests? I'm lucky if I bother writing in asserts for the test cases they actually give us.
20:45
I'm used to testing things somewhat informally so it'd be nice to set up something a little cleaner
wim
wim
Actually
At first it annoyed me the way the test example was written for day 21
DSM
DSM
In my defence I use py.test so my formal tests would look a lot like my informal ones. :-P
@DSM my solutions are public if you ever need some self-confidence:P
@DSM hehe.....I could not work anything out until I wrote tests, to understand what was going on. It was more for me to understand, rather than being proper
Somebody told me I should keep everything in one folder and there was no reason not to ಠ_ಠ
wim
wim
20:46
but now I understand, and I think the author wrote it like this intentionally.
to encourage to write unit-testable code
because a big if/elif chain is very hard to write unit tests for the parts
The only testing I need is "if you copy-paste the answer into the website, does it give you a star?"
as ugly as some of my solutions are, I was able to split things enough to have them testable on their own. (for the most part, I think)
+1 for the KevinTest framework
hm it's not liking my import </noobalert> brbgoogle
Not sure what I'm doing wrong... I have the init file, using periods in the module names, bleh
-1
Q: How do I make my Python program loop?

theExtinctGamerHello I am trying to make an exit function in my calculator, I tried many ways but it does not work. I don't understand how to loop my code and no website explains what to do. Here is my code: #Variables: about = (" + Addition, - Subtraction, * Multiplication, / Division, ** Exponent, % Remain...

ewwww
I accidentally read, this bad?
20:52
closed it
nope....not falling in to this one.
bigger fish to filet
and eat
ugh and finally....got that silly puppet poop finished.
stupid puppet poop
wim
wim
Re: the hardest day
if you look at that
it's hard to escape the conclusion that day 11 has been the hardest for most people on average
but it's subjective. for me day 9 was hardest. day 11 was straightforward, although a bit of a grind.
and I know that, when I go back to AoC, if I skip 11, and do the rest.....will I actually go back to 11....or just leave it as an empty hole in my life.
over 35 % of those who did day 12 didn't do day 11...
Anyone know why "from .RandomInstructionsCreator import random_instructions_creator" is failing?
@idjaw day 11 is easy
wim
wim
20:55
This may be influenced by the fact that I was very drunk when attempting day 9 ... :-\
-3
Q: Python button to change style of html div

justAManNamedNamI have a project in python that will hide a div when my icon is clicked and then collapse when it is clicked again. Right now I have the following html code <img scr="/path/to/img"></img> <div> <p>Press the icon to see more stuff</p> </div> <div id="showOrHide" style="display: none;"> <p>...

wat?
Maybe it isn't liking that the filename is the same as the folder name
Antti why are you doing this
Wed Sep 8513 22:56:09 EET 1993
DSM
DSM
@idjaw: Pay no attention to anyone's humblebragging..
20:56
ah that explains it.
heh
@MarcusS is that in the local directory named RandomInstructionsCreator?
Huh, looks like the problem is the directory name
it doesn't like that I have /Day21/Day21.py
Change the folder name and it seems to work
from Day21Folder.Day21 import scrambler (works) for example, whereas from Day21.Day21 import scrambler fails
DSM
DSM
.. that shouldn't matter.
I thought the same as well
ImportError: No module named 'Day21.Day21'; 'Day21' is not a package
user@host:~$ tree
.
└── bar
    ├── bar.py
    └── __init__.py

1 directory, 2 files
user@host:~$ cat bar/bar.py
def foo(): pass

def bar(): pass
user@host:~$ python3
Python 3.5.2+ (default, Nov 22 2016, 01:00:20)
>>> from bar import bar
>>> bar
<function bar at 0x7feb37b641e0>
but ".bar" fails
>>> from .bar import bar
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: Parent module '' not loaded, cannot perform relative import
21:06
Yeah, doesn't like "from Day21 import scrambler", "from .Day21 import scrambler", or "from Day21.Day21 import scrambler"
well....it's time for me to go out and interact with more holiday shopping shenanigans
good luck, @idjaw, rbrb
I'm going to go out in jogging pants and an angry look in my face
maybe it will cause people to move away and make my shopping easier
>>> from bar import foo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'foo'
hmmmmmmm
DSM
DSM
@MarcusS: what version of Python are you using? And do you have __init__.pys or not?
21:08
weird indeed
>>> from bar.bar import foo
that works ^
@MarcusS which means your from Day21.Day21 import scrambler should work too
Is it fine to mention here if the question is wrongly closed using dupe-hammer?
ImportError: No module named 'Day21.Day21'; 'Day21' is not a package
@DSM 3.5.2, I have __init__.py in the folder, yes
@MoinuddinQuadri I think so, although you could try leaving a comment on the post itself
the hammer-wielder is pingable in comments
and if it's crap that's closed as a wrong dupe, leave it:P
BTW it is crap :P
then move along:P
maybe leave a better dupe in a comment for OP
21:12
@MarcusS push your current state to a branch
@MarcusS "is not a package" sounds bad...it should be one
right?
what's your tree?
@MarcusS you don't need __init__.py - this is Python 3.5
@AndrasDeak: try from .bar import foo and from ..bar import foo. Even I get stuck sometime on these import when I create a new project :/
both fail
21:15
Hit and Trial is all I do
@AnttiHaapala I thought so too, but it didn't work when I omitted it either
Figured wouldn't hurt to keep it just in case
python3 -c 'import day21.day21'
hello
Move on with from bar.bar import foo then :P
@MarcusS where are you running it from?
because
.
└── day21
    ├── day21.py
    └── __pycache__
        └── day21.cpython-35.pyc

2 directories, 2 files
21:15
PyCharm
dev/rough/Advent-Of-Code-2016  master ✔                                                                                                                                           1m  ⍉
▶ cd Day21/

rough/Advent-Of-Code-2016/Day21  master ✔                                                                                                                                          1m
▶ python Day21.py
spoiler_text
spoiler_text
DSM
DSM
⍉? Eh?
:P
@DSM that's part my shell....I just copied what was there
awful prompt
:P
>>> from Day21.Day21 import scrambler
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.../Day21/Day21.py", line 50, in <module>
    instructions = open("data.txt").read().split("\n")
FileNotFoundError: [Errno 2] No such file or directory: 'data.txt'
21:17
hey...my prompt is beautiful
don't listen to Antti prompty...he's just angry
@Marcus seems to work for me --------------------------^
are you issuing it one directory above?
ok...I'm clearly looking for anything to push myself away from going outside
I'm closing my laptop
<3 xoxo
\o
>>> from Day21 import scrambler
bfheacgd
gcehdbfa
wim
wim
21:19
@MarcusS don't put questions into different subdirectories
importing from within the dir Day21 ^
wim
wim
Just use one directory , and imports will work from the same directory
@MarcusS you're in the same dir
try just from Day21 import scrambler
worked for me in the REPL
unresolved reference "scrambler"
21:21
weird?
can you try vanilla python from a terminal?
that's still just a silly IDE, I need an error from a python interpreter :P
huh. works from terminal
So maybe a PyCharm issue
what was this? pycharm?
wim
wim
If you go Run --> Edit Configurations
21:24
remind me not to use it
DSM
DSM
I'm glad that order has now been restored to the universe.
wim
wim
and look at the run configuration you will see what happens
you can fix it temporarily by exporting PYTHONPATH in the run configuration
or you can do the right thing and setup a proper project structure, instead of just using a bunch of random directories
I have separate directories because of situations like these where I may want to add a unit test file / other input files / alternate versions / etc
wim
wim
you're mistaken if you think that means you need subdirectories
If you want subdirectories and you want imports to work, you either have to hack the PYTHONPATH or write a setup.py
@MarcusS make sure that a) you have the project interpreter properly set up
b) that the parent of these DayNN/s is set as the sources root
wim
wim
21:29
Antti's for example probably only works when executing from the same directory as his runner.py
because he didn't package it properly :P
yeah, write a setup.py
@wim lol
but I am using pycharm for my AoC
and it works
wim
wim
No it doesn't
>>> import day01
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-8aebff1666d9> in <module>()
----> 1 import day01

/home/wglenn/git/antti/days/day01.py in <module>()
----> 1 from helpers import get_aoc_data
2
3 d = get_aoc_data(day=1)
4
5 dirs = [(0, 1),

ModuleNotFoundError: No module named 'helpers'
you have to use the special runner.py to do it
compare mine:
/tmp$ python ~/git/aoc/aoc2016/q01.py
262
131
Maybe I should just use something other than PyCharm, this seems needlessly complicated
wim
wim
It's not PyCharm's fault. It's your fault.
:)
@wim my pycharm works, not "my code works"
I actually have no use for the whole runner stuff any more...
wim
wim
21:36
yours could be made to work pretty easily , you just have to write a ~5 line setup.py
but I am lazy
wim
wim
but, I think it's overkill for AoC
at first I thought that my runner would inject some data into the days, timings, etc etc...
wim
wim
yeah, your runner is stupid
the right way to do it is to package the helpers and pip install it
then just run the day*.py modules like scripts
you can use python setup.py --develop to ensure that changes in your helpers package are reflected immediately while you are working on AoC puzzles
Hm, strangely enough, the code still runs in PyCharm despite the unresolved reference error
21:41
this is what we call "teach your dad how to ..."
user image
5
to whomever is confused by Antti's smile ^
I've explained that that pic was taken 10 years ago...
I know:D
I really like day 19's puzzle ;3
it was for example before I had ever programmed PHP for living...
21:43
@AnttiHaapala but weren't you born grumpy?
or ... before I had worked for a "start" "up"...
wim
wim
do you have a recent pic?
Looks like wim is in love with Antti :P
I do... but I can't find any that I'd be grumpy in...
That's his python 2 face
DSM
DSM
21:49
Midafternoon MST rhubarb for all!
recbg, an idiot spilled half a mug of tea on my carpet
rhubarb, DSM
Antti must be from the Mirror Universe. Regular people look depressed and angry and awkward in their photos even when they're having fun; Antti is constantly grumpy yet his every photo is jolly and friendly
wim
wim
is it really 10 years ago??
why would you use a 10 years old pic
@wim yours is similar in age, if I remember correctly
maybe even older!
almost certainly
usually my face looks like a painting by picasso :D
I just keep the jolly photos
wim
wim
ahhh, finnish vanity
22:05
alas since I didn't keep those photos, I cannot prove it.
22:16
sorry, I can't find a grumpy pic of me
22:28
Huh, I thought I was being lazy with my part 2 solution, but looks like everyone else was even lazier with "try all the permutations until they match".
@davidism we've discussed, some of the operations are not exactly invertible
Kevin (?) has some smarty inverse thing where he figures out what states could've led to a given rotated state
wim
wim
You have this problem:
"rotate based on position of letter d":    'ecabd' -> 'decab'
"rotate based on position of letter d":    'abdec' -> 'decab'
so, rainbow table is the correct solution
Oh, right. I guess mine just happened to work.
wim
wim
how were you less lazy than the "even lazier" solution , out of curiosity ?
The serendipitous partner of "where is my off-by-one error"
22:34
Mine builds a lookup table for the rotate operation in both directions. bitbucket.org/davidism/advent2016/src/default/day21.py
I didn't want to figure out the actual formula for reversing it, so I just calculated where each position would end up, then swapped the keys and values basically.
Not sure if it fails for some inputs though.
wim
wim
well, what does it do for the example I just showed
@wim reversing rotate by d from decab returns ecabd
I see the ambiguity, guess it just didn't get me.
If you use half the list len instead of 4, you can invert
4 just happens to be half of 8
Yeah, I saw yours, I was trying for a while to come up with the reverse op but couldn't figure it out.
wim
wim
22:49
hah, I wonder why he would choose a len 5 string for the example code
23:07
Changed it to be unambiguous. Oh well.
wim
wim
looks much like mine now .. except you work in string domain, I'm in list domain
Oh, mine was supposed to be in list too, it would fail if the first swap position came before the first swap letter. Oops.
I must have omitted the list(value) part during refactoring.
wim
wim
23:28
This is the first time I've used globals() and I liked it.
I fear I might become a repeat offender

« first day (2258 days earlier)      last day (2915 days later) »