Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/badouralix/adventofcode-2018
Advent of Code 2018
https://github.com/badouralix/adventofcode-2018
advent-of-code advent-of-code-2018
Last synced: about 1 month ago
JSON representation
Advent of Code 2018
- Host: GitHub
- URL: https://github.com/badouralix/adventofcode-2018
- Owner: badouralix
- License: mit
- Created: 2018-11-30T23:33:31.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-03T20:47:31.000Z (8 months ago)
- Last Synced: 2024-05-03T21:53:38.297Z (8 months ago)
- Topics: advent-of-code, advent-of-code-2018
- Language: Python
- Homepage: https://adventofcode.com/2018
- Size: 4.96 MB
- Stars: 29
- Watchers: 9
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Advent of code 2018 solutions
🌟
🎄
🎄🎄
🎄🎄🎄
🎄🎄🎄🎄
🎄🎄🎄🎄🎄
🎁🎁🎁These are proposed solutions for the [Advent of Code 2018](http://adventofcode.com/2018).
The solutions are automatically tested with travis.
[![Build Status](https://travis-ci.org/badouralix/advent-of-code-2018.svg?branch=master)](https://travis-ci.org/badouralix/advent-of-code-2018)
## Usage
use `./aoc` script
```text
usage: aoc []aoc commands are:
run Runs submissions
create Creates a new submission
config Configures user's parameters
```### Examples
#### Run last problem
```shell
./aoc run
``````shell
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running submissions for day 04:* part 2:
---------------------------------------------------
Avg over all inputs
---------------------------------------------------
---------- ---------- ----------- ---
silvestre 78452 1.99 ms py
degemer 43695 2.39 ms py
jules 23037 2.49 ms py
david 36371 2.94 ms py
thomas 9763 2.97 ms py
ayoub 136461 5.85 ms cpp
evqna 49137 6.65 ms cpp
badouralix 51232 7.26 ms go
tpxp 41668 133.63 ms rb
---------- ---------- ----------- ---
```#### Run specific problems from specific users
```shell
./aoc run -d 1 -d 2 -p 1 -a ayoub -a david
``````shell
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running submissions for day 01:* part 1:
---------------------------------------------------
Avg over all inputs
---------------------------------------------------
----- ------- ----------- ---
david 543 0.46 ms py
ayoub 445 4.94 ms cpp
----- ------- ----------- ---
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running submissions for day 02:* part 1:
---------------------------------------------------
Avg over all inputs
---------------------------------------------------
----- -------- ----------- ---
david 5658 1.22 ms py
ayoub 6448 4.84 ms cpp
----- -------- ----------- ---
```You can use `-r` to run each submission on it's own input, or `-e` to print non-aggregated results.
see `./aoc run -h` for full arguments description.## Contribute
For now we support `c`, `c++`, `java`, `javascript`, `go`, `python 3` (+ `cython`), `ruby`, `rust (stable)` and `bash` scripts.
You can use `./aoc create` tool to create a new empty submission:
```text
usage: aoc create [-h] [-a AUTHOR] [-d DAY] [-p PART]
[-l {c,cpp,go,java,js,py,pyx,rb,rs,sh}]Create a new submission
optional arguments:
-a AUTHOR, --author AUTHOR
submission author
-d DAY, --day DAY problem day
-p PART, --part PART problem part
-l {c,cpp,go,java,js,py,pyx,rb,rs,sh}, --language {c,cpp,go,java,js,py,pyx,rb,rs,sh}
submission language
```you can also use `./aoc config` to setup your local profile
```text
usage: aoc config [-h] username {c,cpp,go,java,js,py,pyx,rb,rs,sh}Configures user parameters
positional arguments:
username prefered username
{c,cpp,go,java,js,py,pyx,rb,rs,sh}
prefered programming language
```### Using python
If you don't use `create.py` tool you should follow this convention:
```bash
day-[number]/part-[number]/[username].py # your submission code
day-[number]/input/[username].txt # your input file
```Your submission code should inherit from the `SubmissionPy` class from `runners.python` module:
```python
from tool.runners.python import SubmissionPyclass MyAwesomeSubmission(SubmissionPy):
def run(self, s):
# :param s: input in string format
# :return: solution flag
pass
```You can add other functions & modules if you need to. Any external dependency should be added to `requirements.txt`.
Once you tested your solution you can submit it by making a PR.
## History
- [Advent of Code 2017](https://github.com/lypnol/adventofcode-2017)
- [Advent of Code 2016](https://github.com/lypnol/adventofcode-2016)