« first day (1892 days earlier)      last day (3281 days later) » 
03:00 - 20:0020:00 - 00:00

03:35
Morning
04:09
Evening.
@sherlock85 the function name's length is irrelevant. I think your problems are possibly arising from using an interactive interpreter. I think you should put your code in a script so that you have a fresh Python process each time you test your code. Look at this answer for how you might do that: stackoverflow.com/a/20158605/541136Aaron Hall yesterday
thoughts on the above are welcome
 
1 hour later…
user559633
05:20
morning :)
05:30
Morning CBG all.
 
2 hours later…
07:13
Cabbage :-)
08:35
@MarcusS should have woken up at 7
took 23 minutes to do despite being harassed by ppl in skype
09:26
@AaronHall Weirdly, I get exactly the same behaviour as the OP reports in the Python 3.4 REPL. I cannot yet understand why.
09:36
Blatter banned for 8 years!
@AaronHall Also get that behaviour if I put it in a script. There must be a flaw somewhere in the argument unpacking. I'll read it later.
@Ffisegydd From where?
@JRS Fifa.
CBG all :)
Fizzy do you mind if I asked you some doubt ?.
@Vignesh ask away, but know that 1/3 of the time I tell the truth, 1/3 of the time I tell lies, and 1/3 of the time I reply with "boop"
I just wanted to know which field in maths should I focus to become a good data scientists. Sorry if this is blunt.
09:44
@Vignesh that depends on what your existing mathematical knowledge is.
I could say "You need to know X", but if X requires Y and Z and you don't have either then you'll have to start with them of course
In a scale of 0 to 10 I would rate it 2. I really never focused on that area :(.
Just think I am a complete beginner .
Can you count? :P
Yeah can do that and a little matrix :P
Not a complete beginner then :P
Do you have a firm understanding of algebra and the ability to manipulate equations?
Yeah can do that :).
09:48
Okay cool. Well Data Science is quite an old field (analysis) which has been transformed recently into this new "Data Science" field.
So in the past I think it was common to specialise in one particular thing, but nowadays I think people instead want much more broad expertise from people (with the occasional specialisation).
So having a strong grounding in a variety of basics is a must.
But more important than that is the confidence and ability to be able to pick up something new, quickly become at-least adept in it, and then roll with it.
Unfortunately this isn't something that can be really taught, it's something that comes possibly naturally or possibly from experience/practice.
So should be jack of all and master of some.
Exactly. You need to have the broad basics.
To take an example which is important: statistics.
You need to have the basics (mean, variance, probability, some basic distributions like Gaussian).
You're not expected to remember the use case and formula for the hypergeometric distribution off the top of your head :P but you should be confident and happy enough that you could read up on it for 30 minutes and then use it in some basic examples.
Ok so my starting should be from stats.
No that's not my point, that was just an example.
Your starting point should be everything (really unhelpful answer).
You need to have a broad knowledge of a lot of maths. Start wherever you want to.
Just don't worry about specialising in any one field.
It is just that you said I need to know X and Y before going Z.
09:55
Ah well for that I was talking about algebra.
If you can't do algebra (manipulate equations) then you really can't do anything else
Oh yeah makes sense :).
But once you have algebra then just pick a subject and start.
Is there any online links that would be good. I heard Khan academy is good for maths.
Coursera
MIT courses
Thanks @vaultah and @Ffisegydd for you time :).
Will start today :).
10:00
I don't have any links for online maths courses.
I used Khan for some financial tutorials and they were good, but they were just videos.
I think the most important thing (at least when starting out) really isn't the knowledge you have (as long as you have the basics) but instead the ability to learn and grow.
And importantly you need to be able to teach yourself. If you get a job somewhere, there may be some specific training but you'll also be expected to teach yourself necessary skills.
And that's very different to being in a lecture theatre, which is why I think a lot of students* have a massive culture shock when they enter "the real world". [*not all students of course]
I agree and will try to grow my knowledge :).
@Vignesh of course maths is just one aspect of data science, you shouldn't let the rest slip at the expense of just maths.
Techies can have the tendency to scoff at some of the softer skills, but they're just as important as the harder skills.
I just felt that I lack pretty behind in maths.
From my current stand I believe I lack two thins one is the ability to express my self in English and the next is Maths. This does not mean I know other things well :P.
I just felt this are key things you need to know to become a data scientist .
10:17
@Vignesh eh. It's important, but softer skills like people skills, report writing, the ability to communicate your point easily, are just as important.
I could produce the most breath-taking analysis in the world, leagues beyond what anyone else can do, but if I can't explain it to someone then it's worthless.
Totally agreed. I have been in situations like that :(.
Were I was not able to explain what I had in mind.
It's not just being able to explain it to someone via speech, but also being able to write concise reports on what you've done
Agreed that does plays a vital role.
 
1 hour later…
11:29
cbg ppl, is anyone doing freelance in Python?
just was thinking about trying it, what are the usual tasks, required skills and caveats?
12:15
@AaronHall read your code. It must be because fn.__name__ string is unpacked as a list when passed to the function you specify when constructing Timer. Can't solve right now (on phone).
user559633
12:31
@bereal I found a lot of Django and web-dev freelance work back when I was a more active freelancer/consultant. It's pretty typical in terms of caveats.
user559633
I ran the numbers (fun way of saying that I did some basic multiplication) and found that it made a lot more sense to be a full-time remote employee.
@JRichardSnape I got the signature on threading.Timer wrong, apparently. the third argument is a list of args to the function, not a single arg to the function... :/ Past Aaron has disappointed present Aaron.
13:04
@tree-stand I'm thinking about some part-time remote stuff in addition to the full-time work.
user559633
@bereal Have you done freelance consulting before? I don't want to tell you things that you already know
@tree-stand nope, not really.
user559633
Oh, okay. I didn't want to accidentally come off as condescending by stating general tips. Social skills were part of my list of things to work on for 2015.
"Condescending" is a big word. That means he talks down to people. :)
user559633
13:09
I've found most online-freelancer jobs to be of really low quality -- it's a race to the lowest bidder and there's both people that won't deliver and freelance companies with a backlog of components (so they can churn out generic cookie-cutter stuff) making a "a machine-learning driven algo-trading site" price get driven down to like $50
^^^ Sounds like legit issues with the freelancer market. So how do you find the legit employers with a decent bankroll?
user559633
On the other end, people hiring on odesk/elance/etc generally are bad about well-formulated requirements and paying. Further, I've found it's a bunch of wantrepreneurs or companies that don't trust you, even though they're probably going to just run your code without a thorough vetting in their architecture
user559633
Looking for an example, one second
user559633
https://www.elance.com/j/python-freelancer/49725012/

Key responsibilities:
- Implement algorithms and dashboard interfaces as required

Responses:
- We like to help our clients with all aspects of their technology needs - from system development and administration to project management
- Wide experience with: - business analyzing - project management - web-development (jQuery, HTML, CSS, Json) - Java (Core, Servlets, JS
@BhargavRao: what was your first vote today, UTC?
13:18
@tree-stand Sounds a bit vague...
user559633
The bid is probably $10 an hour for the hyper specific need of "dashboard interfaces." The first commenter probably has like 5 people in an office building and the second will just take whatever he can get.
@MartijnPieters Exactly 25 mins ago.
Got the hat 22 mins ago
user559633
That's like all of it. Get used to seeing "I just need..." or "need partner to write ___ clone" or getting a "we just need to you pass our coding quiz, write a website that..."
@BhargavRao not when, what :D. Up or down?
user559633
13:21
My suggestion would be to work with a recruiter (ugh, I know) to find flexible/off-hours consulting work that's part time with a single company. You'll spend less time chasing down payments (for $100 jobs, the clients know you're not going to spend 12 hours chasing them down when they invariably don't pay up) and making/responding to bids
@MartijnPieters Upvote. Lol, read that wrong :P
@BhargavRao Thanks for confirming the hypothesis :-)
@tree-stand thanks a lot, that's quite descriptive :)
You earn it for your first vote today. Upvote -> White hat. Downvote -> Blue hat. First votes on other sites in the SE network then give you that same colour of hat, regardless of the vote.
@MartijnPieters Then congrats on "Archimedes" :)
13:24
Martijin you look like a lego toy :).
ugh recruiters too. that's why I network my butt off.
Martijin you look like a lego toy :).
Got a +4 lead on the leaderboard. Need to extend it.
I used to be in sales (financial) so I can handle it.
@BhargavRao Apart from cleaning up a few more comments than usual, I haven't even tried to earn hats yet.
13:25
@MartijnPieters I know, else you would have easily got 30 by now. :)
Mod life is busy ;)
user559633
@bereal No problem. As a general rule, I'd say avoid anyone looking to have you do web scraping or write a "clone" of an existing site as I've found them to be the most cagey about paying. Don't be afraid to assert yourself in what you know you should be paid, and as usual, the medium matters -- elance and odesk are ghettos. Python job board will be better, converting a "can you come work for us full time" to a "we'll send you overflow work" is best.
@VigneshKalai I am a toy.
@MartijnPieters I saw someone with your avatar, they had about 6k rep, sockpuppet?
@AaronHall Nope. The avatar is not exclusive.
Someone on SO actually used it before I even joined.
@tree-stand what's so special about web scraping?
13:29
ah, does it have any meaning (as there is none that I am currently aware of)?
Except "Explorer" all other hats can be earned. Need some heavy effort for the remaining 2. :/
hats are fun, but too temporary
Yep. But toppin the leaderboard is once in a life time opportunity.
Well good luck!
Thanks :)
I just have 3 tough hats more to get
13:40
@bereal I imagine those are flaky activities (scraping, "clone"-ing) - probably have a lot of black-hat wannabes/script kiddies that want to use these sites to get free custom-made stuff.
@tree-stand do you mean "clone" as in same functionality or same appearance and feel?
user559633
@bereal Think about the web-scraping questions on SO. Now imagine that the person thinks he's going to become a dot-com millionaire based on scraping or wants to be king of a bunch of shady porn sites. Do you want to deal with that person and do you think he'll pay you on time without hassle?
user559633
@AaronHall Great question. You won't get it answered on a freelance job from the internet besides "it has to do everything the original site does."
So they may want to use it for phishing
Maybe this is game-theory: do you deal with cheaters? will they not try to cheat you?
user559633
Well, sure, or they think that all they need to do is copy a facebook and all of a sudden they'll be standing out on broad and wall street in manhattan for their IPO
@AaronHall Someone once left me a LinkedIn endorsement starting with "Invisible Framework Coding Ninja", a sentence I've been using as a tagline ever since.
13:45
so we could expand that to "try to cheat the market?"
The avatar followed from that.
user559633
stackoverflow.com/questions/34273434/… man i don't even know what to do with this response
I just googled for options and stuck to the cute ninja version.
Welp I've been stuck on AoC #19.2 for about four hours now. My first attempt was something like O(N*C^G) which is fine for part one when G=1, but bad for part two when G ~= 100.
user559633
13:51
I feel like the person that commented on my answer didn't even look at what the OP's code does or the misspelled name of his var. He just wants to bark off other answers for his lazy approach.
19 has a pretty high blue-to-yellow star ratio, so I guess others are in the same boat with me.
Can the CSSSelect module be used independently without lxml? It has a seperate pip package. but lacks docs
People who want to get rich quick by copying others - will they willingly/gladly pay you on time for a one-time custom coding session? If you have a long term relationship and they value their reputation, they'll gladly pay you on time because they want you to continue working for them.
user559633
@AaronHall The two are almost mutually exclusive, in my experience.
These are people that think you can write them a facebook with a month's work, and it will never require upkeep. They'll burn bridges because they got to the side of the river they needed, so it's of no use to them any more.
user559633
13:54
If they're fine just doing a ripoff and want it done on the cheap, they're not going to pay you on time.
Yeah, I'm not phrasing that as clearly as I'd like.
user559633
Do you think that people try to hire on elance sites because it's convenient? No, they're doing it because they don't want to pay someone local.
Just charge them 200% your normal fee, with half up front. </armchair freelancer>
user559633
I'm still stabby about that NLTK commenter. Like if someone was learning multiplication and was doing it by addition and was making a mistake in the tens column and you corrected it, he'd come along and say "ugh are you seriously just correcting that? the student should be doing the tractenberg system. i earnestly believe that i am being helpful right now."
The world is harsh and unforgiving. It is known.
13:56
I currently do data = lxml.html.fromstring(result, base_url= BASE_URL) and then data.cssselect("#ctl00_OnlineContent_tdOwner") . But now with CSSSelect I have no idea on what to do
Let's not be so cavalier. I didn't take the time to wrap my head around the question, so I don't feel qualified to answer.
user559633
ugh i try to leave the mtfl lifestyle and they keep dragging me back. i got a short fat trainer in a gray sweatsuit representing me saying "malevolent type?! he don't do that no more!!" but they won't just leave me be
Morning cabbage.
user559633
@AaronHall it's a "how do i turn internet speak to a standardized form i can classify. here's what i have - a non-working list comprehension matching on apostrophes"
Middle Tennessee Football League?
user559633
14:01
my answer is, give your code some breathing room, here's why i'm doing it this way, here's why yours didn't work. you know, a "this will get you over this minor hurdle" answer
user559633
@AaronHall malevolent typist for life
user559633
the other answer is "use the tokenize method from nltk. it does the same thing. i'm not going to give you code you can use to learn from"
user559633
i'm over it
Currently I'm trying the following
data = HTMLTranslator(result)
css_var = data.css_to_xpath("#ctl00_OnlineContent_tdOwner")[0]

print(css_var)
I always quote the question I'm answering in bold as a preface to my answer, so it's immediately clear exactly how I see the question and thus helps me frame what I'm writing as an answer.
Busted my palindrome with a downvote...
14:06
Never mind
cssselect parses CSS3 Selectors and translate them to XPath 1.0 expressions. Such expressions can be used in lxml or another XPath engine to find the matching elements in an XML or HTML document.
I should translate that to regex since the site doesn't change. I know regex is bad for scraping, but the site never changes
user559633
@AaronHalllol saw the passive aggressive edit, lollll
aren't you tristian? How have you changed your username?
lol
user559633
also, that OP is just doing a drive by of "do this for me"
user559633
@Wally xmas themed. i'm nothing if not really fucking jolly.
cbg, all
user559633
14:12
cbg marcus
Please don't frame me as passive aggressive. I value transparency, though there is a time for discretion as well.
user559633
:)
user559633
user559633
going back to bed
user559633
every time i go into a bear's cave and then provoke him, he tries to defend himself. if only this was avoidable
Clearly it is incumbent on the bear to fence off the attractive nuisance that is the entrance to his cave, or at least post some signage:
I wasn't able to avoid the star wars spoiler horde this weekend...
Were you able to see the movie yet?
yesterday, by Ffisegydd
The room is a Star-Wars-spoiler-free zone until January 3rd.
I know that's what made me mention and no I haven't seen it yet
user559633
luke vader kills a r2d2 with a light sword on tattooing
14:51
I did not expect Tristan to turn up in the middle of Part 3. What a shocker.
Who did they get to play you? It looked like Jennifer Lawrence.
user559633
would be less mediocre a franchise
user559633
jennifer lawrence fishburn, actually. take the red pill and stay on hoth. take the blue pill and see how deep rabbitmq can go
That is a terrifying visual.
I didn't know they finally tied the knot.
15:13
rbrb
Okay, just two reps away from 100,000. Yay :-)
Just hit 30k!
downvotes everyone
Morning everyone
15:22
don't worry, serial downvotes are reversed by the script...
We can actually script it, right? :D
I'm just parroting what I've read all over SO and SE metas...
I have to wait for one more day before I can reach 100k :(
get an accept or a bounty - cakaw!
Can you create a relative symbolic link?
15:24
@AaronHall Oops.. I think I am already sleepy. Totally forgot about the "accept". Thanks man
polly want a cracker?
39 votes to Python gold. Slowly creeping up on it.
I can't get the websockets example to work. Has the asyncio module removed the coroutine decorator?
Finally a hat I can get behind.
15:30
> This video contains content from kylepatrickmusic. It is not available in your country.
Youtube's protecting me from unamerican influences.
Oops. Sorry about that :(
:? - kinda looks like a nose, but it's a question mark mouth.
Oh shit, just realised naming a file as "socket.py" is a bad idea :/
What wins when you try to import socket?
@RishavKundu For this very reason I only name my Python scripts after one-time messages that are pulled from a bingo machine by an elderly Scottish woman.
15:38
@RishavKundu it's fine it you stick it in a package and access it with its fully qualified name
No, but you guys, Linux is SO secure because it's open source. ;)
Meh, if the attacker has physical access, you're pwned regardless of OS
You know that Windows machines would get a virus by being plugged into the internet in 2005, right?
Patches are already released? I remember Windows 95 you can just hit escape once and you were past the login screen.
16:11
How long does it take Windows to patch stuff?
16:40
cbg
16:51
Am I correct in thinking that I can use a dictionary with multiple records/rows like you can with JSON? I'm trying to figure out how to append a record (not a key value pair) to a dictionary but am not finding anything. Does that make sense? Example: {'name': 'Jack', 'Age': 97}, {'Name': 'Bob', 'Age': '45'}
That line creates a tuple, you probably want [{'name': 'Jack', 'Age': 97}, {'Name': 'Bob', 'Age': '45'}], which results in a list
You can append more records to it
json syntax is very similar to Python's literal syntax so you can often port one to the other with no changes.
What would the append look like in that case? list.append({'name': 'Jack', 'Age': 97})?
Yeah.
16:56
This week is off to a bad start for me :/
Why does it use [] to create a list, but () to append a list?
all method calls use ().
Ah yeah. That makes sense.
Went to copy website from machine to machine and I accidentally moved and one computer had a force restart for windows updates...
oops
17:00
That makes sense. Thanks. I was searching all over the place, but all I could find was adding a key/value pair.
Makes sense. You needed a list-based solution and I'm guessing you were researching just dicts.
So would you call this a list of objects rather than a dictionary? {'name': 'Jack', 'Age': 97}, {'Name': 'Bob', 'Age': '45'}
Yes No, a tuple of dictionary objects
Can I get a math check on this answer? By my math, the value of the float should be 6e-36, but it's outputting as 7e-45. It feels like a denormalized number, but I thought all denormalized numbers had exponent 0.
That exact syntax gives you a tuple of dicts. [{'name': 'Jack', 'Age': 97}, {'Name': 'Bob', 'Age': '45'}] is a list of dicts.
17:03
Yeah, I didn't know what term to use.
Sorry, I typed the wrong thing.
That makes sense
Do we have a [spoiler][/spoiler] tag in chat?
DSM
DSM
Morning cabbage.
cbg, DSM
@corvid You can do [hover for spoilers](http://www.example.com "insert spoiler text here")
DSM
DSM
But careful: if you get it wrong and you spoil someone, you're banned forever.
17:07
>! is this a spoiler?
nope...
@MattDMo nope.
The link title trick Kevin mentioned is a good workaround.
@MartijnPieters yo hat so cute
@AwalGarg If only I could wear more than one. I'd add the boat.
@QuestionC I tried plugging the bits into my float visualizer and I got 1.13923781556e-305. But I guess that's because I'm using double precision.
DSM
DSM
We'll probably get the ability to wear multiple hats before we'll get spoiler markup..
17:09
wait... noooo, yours is the same as mine, but because you are a mod, you get a blue one?!?!
blasphemy!
@AwalGarg no, the color is chosen randomly... at least, so says Meta
@DSM If your is accompanied with the tag, it is automatically added the after seconds chosen from a PRNG.
@MattDMo ahh
here is the Meta.SE discussion on the secret hats
I want the blue one :( tried my luck on another site on the network, hopefully I get the blue color there! :P
@QuestionC Ok now I tried struct.unpack("f", struct.pack("i", 25)) and got 3.5032461608120427e-44.
17:16
Cool, a third answer.
I don't think denormalized numbers are involved, as they should only occur when the exponent is 0. Uh, I think.
Going back to see SW a second time at some point this week
Ah, yep. "Values of all 0s in this field [exponent] are reserved for the zeros and subnormal numbers; values of all 1s are reserved for the infinities and NaNs."
Printf is giving me 7.006492e-45. My 2^-117 expectation is 6.0185e-36 (according to windows calculator)
Wolfram Alpha says 6.018531076210112040799931070577897870431567650 × 10^-36 for 2^-117.
DSM
DSM
17:31
Why not just check using the Python console? #confused
What's the question?
"What is the value of the single precision float with binary representation 0 00001010 0000000 00000000 00000000?"
http://stackoverflow.com/a/34400472/3294441

Something weird's going on here with that output. The smallest normalized number for a float is 1.18e-38, so printf is in subnormal territory.
I get the feeling this is just an odd interaction between printf, %e, and tiny numbers.
17:52
7.006492e-45 unpacks into 5, fwiw
It's endianness.
But I get the same answer on big-endian and little-endian systems.
>>> f = 7.006492e-45
>>> struct.unpack("<i", struct.pack("<f",f))
(5,)
>>> struct.unpack(">i", struct.pack(">f",f))
(5,)
>>> struct.unpack(">i", struct.pack("<f",f))
(83886080,)
>>> struct.unpack("<i", struct.pack(">f",f))
(83886080,)
@corvid Did you finally get fed up with MongoDB?
Yea, Floats are little-endian on my linux system, and big-endian on my sun system. I didn't realize that floats flipped like that.
@MorganThrapp Not THAT upset yet... but bretty close
18:35
don't really know what he wants me to say in my answer...
Well, he's saying your answer won't always work, because it relies on interrupt_main and that can fail. Maybe you could reference that potential problem on your answer, particularly if you can reproduce the failure reported on the other question.
sleep... that's the problem
because it doesn't actually interrupt the sleep
So now I need an algorithmic time-sink or a sleep that wakes up every second...
recursive definition of fibonacci?
18:55
There's 2. The intuitive one, and the tail-recursive linear one.
ok, already had an example that woke every second, and I'll modify the other one to demonstrate that sleep isn't interrupted
19:15
Hour 9 of trying to solve AoC 19.2. I get the feeling that I've missed something obvious.
I've iterated through all possible strings that are 9 replacements away from the string "e". There are 1,530,033 of them. My target string is worst case ~300 replacements away.
@Kevin you want a spoiler already?
I assume the thousands of people that have solved this problem in the last three days hasn't gone through a search space with 10^300 items.
exactly
they have gone through a search space of about 300 items
a) do it backwards, b) do it greedy
19:18
I recognize that I don't necessarily need to go though every intermediate replacement. Ex. with the rules a => x; b => y; starting with "ab", I don't necessarily need to consider "ab == xb == xy" distinct from "ab == ay == xy". Order of replacement doesn't matter unless you're trying to replace a character you just inserted.
cbg
@Kevin start by throwing out all the code you wrote for 19.1
I have tried going backwards from the target molecule to "e", but it is not yet apparent to me how to do so greedily. There are 199890 different strings that are 3 replacements away from the target molecule, the shortest of which is 486 characters.
I've still yet to do 17.
19:21
you do the substitutions backwards always replacing the longest existing product for the shorter molecule
I suspect I may have gotten all of the ones done that I'm going to bother to do.
Ok, I'll try that. I figured that would lead me down a dead end, but it's possible that the puzzle maker mercifully made that not the case.
19.2 can be solved with a greedy approach -- you can try looking for large sections that you can reduce, or you can try a probabilistic method, etc
it takes 0.03 seconds to run my solution
it also is simpler than the code that I wrote for 19.1
@AnttiHaapala What method did you use in the end?
19:24
Like, consider the input
e -> fc
f -> ab
Q -> abc
target molecule: abc
If you go greedy and replace abc with the longest possible replacement, you get "abc = Q" rather than the desired "abc = fc = e"
@Kevin Try adding some randomness to it
In the above case, sure, randomness would cause you to travel down the right path 50% of the time, because there are only two possible paths. But in the real problem, there are 10^300 possible paths.
anyone here have Windows easily available and can test some code for me?
@AaronHall Sure.
Try the code in this answer: stackoverflow.com/a/31667005/541136 let me know if anything behaves weirdly.
19:32
Bad luck for me. With the greedy approach, I get down to "'NRnBSiRnCaRnFArYFArFArF'" before there are no legal replacements to make.
@Kevin sounds like the classic over thinking problem
Yes but unfortunately being aware that I am overthinking the problem does not give me any insight to what the actual solution is.
Usually when I take a break and stop thinking about it, I get the answer.
@AaronHall Looks fine to me. Other than it running really quickly.
sleep(1) sleeps an entire second, right?
19:34
It prints countdown started then waits a couple seconds.
I stopped thinking about it this morning and I came up with a college-level tree algorithm which almost certainly is not the intended solution.
Then prints
ah, that looks weird
3, 2, 1, 0, countdown finished
countdown started
Probably needs to flush
19:34
10, 9, 8, 7, 6,     sleep(1)
KeyboardInterrupt
This is in 3.
It works fine in 2.7.6.
Yeah, definitely needs to flush in 2.x.
@Kevin do it like this:
I just got an answer that happens to be the right answer, but it's unsatisfying because my algorithm finds a path, not the shortest path.
@Kevin Admittedly, the optimal methods for this problem depend a lot on the nature of the input data. In this case, there aren't as many overlap cases that arise. In fact, there is provably only one possible solution to the molecule (the "fewest steps" sub-problem is a bit of a red herring).
I want to make a print function that takes a flush=True argument in Python 2...
@Kevin you can prove it that it is the shortest path, based on the rules
if you want a complete answer, then make an algo that proves that the greedy algo is the correct one for your input :D
19:40
@MarcusS For your molecule? Or for any possible molecule?
Is there some quality of the replacement rules that makes it so there's only one legal path? Did the puzzle makers make sure that there would never be a rule set like "e -> a; a -> aa; a -> aaa; target = aaaaa...aaaaaa"?
@Kevin marcus is correct
I picked the substitution order at random for each step
I believe but I do not see
and it always results in the same
I random-shuffled them :D
19:42
Yeah that's what I ended up doing.
except...
there is some case which does not reduce correctly hmmh
every 10th or so seems to hang.
It's more like 60% hang for me
but "try them in the order of decreasing length one rule a time"
@Kevin If you want to understand why (and have a bit of fun trying to figure it out on your own), try to analyze the input file and see what patterns you can pick out of the transitions
You'll be able to deduce why the solution you found must be the only such solution
I did a little bit of analysis but the only thing I determined was "there are no rules whose left hand side is 'C', and there are no 'C's in the target molecule, so I can discard all rules with a 'C' in the right hand side"
19:48
It is possible to reduce it to an irreducible molecule if you apply the rules in a random way (although it will pass often enough to result in a short runtime overall) -- but given certain rules, it will always reduce in a deterministic way
thoughts?
try:
    range = xrange
    def print(*args, **kwargs):
        flush = kwargs.pop('flush', False)
        print(*args, **kwargs)
        if flush:
            kwargs.get('file', sys.stdout).flush()
except NameError:
    pass
@Kevin Isn't it strange how often Rn shows up?
@DSM you're one behind
DSM
DSM
@AnttiHaapala: yeah, yeah. I'll get to it. :-)
no that'll give me maxrecursion
try:
    range = xrange
    old_print = print
    def print(*args, **kwargs):
        flush = kwargs.pop('flush', False)
        old_print(*args, **kwargs)
        if flush:
            kwargs.get('file', sys.stdout).flush()
except NameError:
    pass
DSM
DSM
19:57
Sometimes it's tempting to ask "Did you consider hiring a programmer?" when someone posts a vague description of what they want instead of a question. But that would be very unconstructive.
Just got an email from a client with the subject line "WAITING FOR FILE!!!" and no body to the email or any context. Time to find out what they want. :/
They want the file. Send them the file.
03:00 - 20:0020:00 - 00:00

« first day (1892 days earlier)      last day (3281 days later) »