A command line tool for Project Euler

## Project description

## EasyEuler

EasyEuler is a configurable command line tool for working with Project Euler. It provides support for many languages out of the box and adding more is easy.

This project was inspired by EulerPy and intends to provide the same functionality for a larger variety of languages.

## Usage

Use `create` to create a new problem file:

$ easyeuler create 1 python Written to euler_001.py $ cat euler_001.py """ Problem 1: Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """

Once you’ve come up with a solution, output the result and check if it’s
correct with `verify`:

$ easyeuler verify euler_001.py Checking output of euler_001.py: [no output] # output in red $ echo print(12345) > euler_001.py $ easyeuler verify euler_001.py Checking output of euler_001.py: 12345 # incorrect solution, output in red $ echo print(42) > euler_001.py $ easyeuler verify euler_001.py Checking output of euler_001.py: 42 # correct solution, output in green

You can even time the execution of your solutions with the `time`
flag:

$ easyeuler verify --time euler_001.py Checking output of euler_001.py: 42 CPU times - user: 16.7ms, system: 3.33ms, total: 20ms Wall time: 1.02s

…and execute multiple at once:

$ easyeuler verify * Checking output of euler_001.py: 42 Checking output of euler_002.c: 12345 Checking output of euler_003.py: [error] # [error] is displayed if an error occurs during execution

Some problems come with additional files, use `generate-resources` to
generate those:

$ easyeuler create 22 python Written to euler_022.py $ cat euler_022.py """ Problem 22: Names scores [....] This problem references the following resources: names.txt """ $ easyeuler generate-resources 22 # specify the problem ID to generate problem-specific resources Created names.txt at path . $ easyeuler generate-resources # or leave it empty to generate all resources [....] Created 326_formula2.gif at path . Created 326_formula1.gif at path . Created 327_rooms_of_doom.gif at path . Created 330_formula.gif at path .

Use `list` and `show` to browse problems:

$ easyeuler list ╒══════╤════════════════════════════════════╤══════════════╕ │ ID │ Name │ Difficulty │ ╞══════╪════════════════════════════════════╪══════════════╡ │ 1 │ Multiples of 3 and 5 │ 5% │ ├──────┼────────────────────────────────────┼──────────────┤ │ 2 │ Even Fibonacci numbers │ 5% │ ├──────┼────────────────────────────────────┼──────────────┤ │ 3 │ Largest prime factor │ 5% │ ├──────┼────────────────────────────────────┼──────────────┤ [....] $ easyeuler show 2 Problem 2: Even Fibonacci numbers Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Find the sum of all the even-valued terms in the sequence which do not exceed four million.

## Configuration

EasyEuler is designed to be configurable and adaptable to any language
you may want to use it with. It follows the XDG Base Directory Specification
for locating configuration files. The default location is
`$HOME/.config/EasyEuler`.
To see examples of configuration, look at `config.json` and the `templates`
directory inside the package.

### Languages

Adding a new language is as easy as adding a few lines to the `config.json`
file.

A language has the following general attributes:

`name`- name of the language. (required)`extension`- file extension for the language. (required)`template`- name of the template file. (default:`name`)

These commands are executed in order when using the `verify` command:

`build`- build the file if required.`execute`- time this command and compare the output to the solution. (default:`./{path}`)`cleanup`- remove binary files after execution, etc.

### Templates

Templates use the Jinja2 templating engine.
New templates should go in the `templates` directory inside the configuration
directory.

## Requirements

EasyEuler requires Python 3.5+, along with the Click, Jinja2 and tabulate modules. It has been tested on Windows and Linux and it should work on any other Unix-based platforms, including macOS.

## Contributing

Please see CONTRIBUTING.rst for information on how to contribute to this project.

## Acknowledgements

The problem descriptions are courtesy of the EulerPy project, which formatted the descriptions from Kyle Keen’s Local Euler project into a human-readable form.

## License

EasyEuler is licensed under the MIT license.

## Project details

## Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|

Filename, size EasyEuler-1.2.1.tar.gz (635.2 kB) | File type Source | Python version None | Upload date | Hashes View |