Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Python-based Project Euler command line tool (github.com/ikeviny)
58 points by skreuzer on June 28, 2014 | hide | past | favorite | 35 comments


Including solutions is just a terrible idea. Not only is it discouraged by the maintainer of the site himself [0], it is also just inconsiderate to the community.

The worst thing that could happen to Project Euler is people creating profiles and populating them with answers they didn't come up with, so they can pad their resume or other. Having PE be flooded with profiles that have hundreds of "solved" problems would ruin it for those of us who enjoy the challenge and take pride in their solved count.

When you are publishing large corpuses of answers to Github, your personal site, etc., you make it that much more likely for Project Euler to be ruined in the future.

I get the incentive behind including solutions in your tool, and there are definitely worse things in the world- but it's just not cool and disrespectful to the PE community.

[0]: http://projecteuler.net/about - see penultimate entry


"The worst thing that could happen to Project Euler is people creating profiles and populating them with answers they didn't come up with, so they can pad their resume or other."

The worst thing that could happen to Project Euler is that it goes offline and doesn't make the questions available. The second worst thing is that it stays online, but doesn't let you know if you've solved the questions.

I was going to add the third worst thing would be for Project Euler to stay online, validate answers, but not add any questions - but, really - there are enough questions now to keep me going for a couple years.

Perhaps you and I look at PE differently, but, I do not care at all how many other people solve, or don't solve questions - beyond giving me some insight into how difficult some questions are, and whether I am missing something obvious.

Solving PE problems is a reward in and of itself - I would never be so douchey as to point to my PE Profile - For one, there is no way of determining how long I took to answer the questions, and, even a scripter of my incredible limited means, can answer most of the questions with enough time and effort.

I think PE is one of the great gifts on the Internet, and, while I think anyone who actually uses a "show answer" tool is being retarded, and both (A) completely missing the point of PE, and (B) robbing themselves of the experience of solving the problems - the only person who is being hurt by that tool, is the person using it, not me.

So - I perhaps agree with you that the feature is a Bad Idea(tm), that does not bring value to it's users, but, at the very least, does not impact me negatively.

* What would have been cool by the author, is that instead of giving answers, would have been to give hints pointing to various algorithm, or mathematical concepts. For example, there might be a question that is trivial to answer if you know (and can implement) Dijkstra's algorithm - and 90%+ of the value of the question can be reaped by reading up about Dijkstra's algorithm, seeing how it applies here, implementing it.

I'd still like to spend an hour or so on my own, but if I run into a wall, simply getting a hint that says, "Dijkstra's algorithm" or "Trémaux's algorithm" would still let me capture most of the value of the question.


It would definitely be cool to implement a `--hint` function to complement `--cheat`. However, in order to do so, I would need to find a resource that contained said hints on a per-problem basis.

Alternatively, if there is a generalized list of useful algorithms for Project Euler somewhere out there, it would be trivial to add it to a short "problem hints"-esque section in the readme.


Note - replying to myself - I just realized that of the two things that I considered to be the "Worst Thing that could happen" - are actually both prevented from happening by EulerPy. I honestly hadn't considered that when I was replying to the OP.

Here's hoping we can get more than 202 questions from PE into EulerPy.


All 476 (with graphics) are over here: http://kmkeen.com/local-euler/


The solutions that are stored in the package are only plain answers - not actual algorithmic solutions to each of the problems. I understand the concern, but in my opinion, if someone had a collection of solutions that were derived specifically from the answers derived from EulerPy, it would likely consist of just `print n`s (which shouldn't be impressive to anyone by any means). I apologize if my project has degraded the integrity of the Project Euler community.


Please don't apologize - I absolutely love what you've done here - I'm frequently in situations where I don't have good internet connectivity, but would love to spend time keeping my scripting skills sharp with PE - and now I can. I'd previously scraped the questions off of PE, but could never check my answers until I was back online - but now I can!

Your project is going to have a meaningful, and measurably beneficial impact on my life, and I'd like to say thank you very much for the hard work you've put into this wonderful tool!


Thanks for the kind words. It's fantastic to see people making use of my project!


No need to apologize. IMHO your project is great for the Project Euler community.


I don't think that's any better. Please consider removing them and leaving it to people to discover the answers themselves.


For my part, I'm tired of the various all-knowing fonts of wisdom who Know Better deciding what I can and can't do. The PE guy can certainly say his piece, and as it happens I agree that it's dumb to peek at solutions as a general strategy; but sometime I might want to, and I'm glad the author of this package included the option.


Next time I have a long flight, I can now go through Project Euler and stop when I'm right. Having solutions is nice to have.

One interesting potential mode would be to (as suggested below) encrypt the solutions and switch --verify to --attempt, then keep track of # of attempts for scorekeeping.


What other people do or have on their profile has no impact on the pride I have in the work I do, and the more widely the profiles are recognized as not useful as any kind of certification the better.


It does serve to lessen the perception of the accomplishments from others. It also could easily through off much of the language and solution metrics tracked by the site, which have little intrinsic value, but are interesting nonetheless.


> The worst thing that could happen to Project Euler is people creating profiles and populating them with answers they didn't come up with, so they can pad their resume or other.

That would be quite a feat, considering:

"As of 27 June 2014, problems are now accessible again and their solutions can be checked. However registering and logging into accounts remains disabled, and no new problems are being added."

I was actually going to add a feature request to allow "solving" problems via the command line -- but I see the site itself (while it doesn't register profiles/solutions) uses a captcha -- So I guess the script would have to fetch that, display it, and ask for the captcha number as well :-/

(Or try to defeat the captcha which would of course be much more interesting, but perhaps less good for the euler project...)


Oh wow, didn't think this would get posted to Hacker News. I only submitted a link to /r/learnprogramming and /r/Python since, being my first ever Python project, it seems pretty rudimentary compared to some of the amazing things I see here. I'm glad to see people are liking it (and perhaps more importantly that I didn't make any massive coding mistakes)!


I'm equally surprised at seeing my Local Euler being used for something.


In retrospect, I probably should have contacted you before using Local Euler in this project. Hopefully you don't mind.


Nah, it is cool. I really find this whole thing very amusing from an accidental historical preservation perspective. I do hope the rest of the puzzles can be recovered.


Fixed.


Having a --cheat option seems like a poor decision. Having easy access to every solution (especially as it exists in a plain text file) harms the experience of struggling through a problem until the correct answer is reached.


I considered this, and figured since the solutions are stored by the program anyways, it would make more sense to include the functionality rather than to omit it. Naming the option `--cheat` was an conscious decision to discourage a reliance on it. Then again, if someone really does want to view the solutions rather than work through the problems themselves, I suppose it's their loss anyways.


Well, the general upside to googling for an answer is that often when someone is providing you with the numeric solution they are also describing their algorithm and implementation. Having it in plain text right on the local hard drive might be more tempting with fewer benefits.

Potential Solution: store the solutions file in an obfuscated format that is easy to decrypt


> the general upside to googling for an answer is that often when someone is providing you with the numeric solution they are also describing their algorithm and implementation

Can't this be seen as a downside as well? I'd much rather have an option of first just seeing if I'm eg off by a magnitude, or an iteration -- rather than having my fun ruined by someone showing me the whole solution...


Storing them in a sqlite database could be enough "encryption" for the beginner type to not find the solutions right away.


Good point; I'll keep this solution in mind.


Possibly md5 them or something?


Ah, I like this idea. I'll look into implementing it.

Edit: I just realized that implementing encryption with respect to the problem answers would imply removing the `--cheat` option. I've started a discussion [1] in the repository's issue tracker about this topic.

[1]: https://github.com/iKevinY/EulerPy/issues/3


What about the latest problem? Should we get the function work only after you update the solution databases?


Important to note that these are just the first 202 questions, and they don't include any graphical resources.

Some of the PE questions, will probably benefit from the actual images, particularly ones like:

https://projecteuler.net/problem=252


Hmm, I'll have to keep this in mind when I get to adding problems like this. Time to convert GeoGebra images to ASCII art /s!


That's great! Now I can try Project Euler in Python, I've just started learning Python, I'm loving it so far after putting it off for 10 years...

Thanks, keep up the good work!

- Giancarlos


I used Cython and PyOpenCL on some of the problems, but similar idea: https://github.com/CraigJPerry/project_euler

Not sure about the cheat option though, kinda goes against the ethos of the site?


Hey Guys, Do you want to try it immediately? I've created a terminal.com snapshot. Feel free to test it and comment! https://terminal.com/tiny/aEVfrRHg8K


I like the idea of downloading the question, and having it placed in the source code file. I myself extract the problem into a comment (although, I use C) before trying to work out the solution, so this could save me valuable seconds. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: