euler is a command line tool for running and
submitting Project Euler problems. This is what a successful submission looks
like:
$ sudo port install euler
$ euler -p 1 problem1.py
I've submitted it to Macports, but in the meantime you need to do a little bit of work to get started. You need the jp2a, ImageMagick and BeautifulSoup libraries installed.
$ sudo port install jp2a ImageMagick py27-beautifulsoup
Then grab the euler script (just one file) from here and place it
somewhere in your PATH.
euler requires two pieces of information from you: the number of the
problem you are trying to solve, and your proposed solution. You can do this in
one of a few ways:
Submit a problem number and a problem file.
euler will run the problem file and treat the first line of output as the
solution.
$ euler -p 22 problem22.py
$ euler -p 17 myjavasolution.java
Submit a problem number and a solution.
Use the -s or --solution flag.
$ euler -p 14 -s 24289
$ euler --problem 11 --solution 242113
Pipe the solution to Project Euler.
Here you go, fancy pants:
$ perl problem240solution.pl | euler -p 240
This assumes that your file will output the solution as the first argument to stdout.
You can also save your username and password in a file named
.eulerrc in your home directory (~/.eulerrc or
/Users/yourusername/.eulerrc). The format is:
[login]
username = myusername
password = mypassword
Note that there are no quotes around your username or password.
Here are the languages currently supported by euler:
C
C++
Haskell
Java
Python
Ruby
If your language isn't supported, you can pipe a solution in via stdin:
$ sml problem4.sml | euler -p 4
Or specify your solution as another argument on the command line:
$ euler -p 4 -s 99032
Pull requests to add new languages are also welcome.
If you have any questions please email me at kev@inburke.com. Thanks!