Giter Club home page Giter Club logo

adventofcode-template's Introduction

Advent Of Code - Template

Install

$ composer install

Add New Puzzle Solver

Do add new Solver for a day, you need to create a new Class PuzzleDay{Number}.php in src/Day/. You can copy / paste the src/Day/PuzzleDay0.php and rename it to have base class puzzle day solver.

For the input, the data are in data/ directory. You can also use data/day-0 as template inputs files.

  • data/day-{d}/inputs.txt: main input for the puzzle day.
  • data/day-{d}/inputs-part-{p}-example-{n}.txt: Examples inputs. You can try to verify your solver with example
  • data/day-{d}/inputs-part-{p}-expected-{n}.txt: Expected results. Here, you can put the expected result for each example.

Solve puzzle day

Command

Use    : bin/aoc solve [OPTION]...
OPTIONS:
  -d ARG, --day=ARG                     Day to solve - MANDATORY
  -e,     --example                     Example Only
  -f,     --functional                  Activate Solve in functional programming style
  -s,     --skip-empty-lines            Remove empty lines from inputs

Example

Run base solver

By default, we just use one base solver.

$ bin/aoc solve --day=1   
------------------------------------------ EXAMPLES ------------------------------------------
*  :  24000 - expected: 24000
** :  45000 - expected: 45000
------------------------------------------- OUTPUT -------------------------------------------
*  : 100000 - [0s] - [2.2MB]
** : 200000 - [0s] - [2.2MB]

Run functional solver

But you can also try to add solver in functional programmation, by using velkuns/pipeline for example (or any custom / tiers code). In this case, you'll need to override partOneFunctional() && partTwoFunctional() method and put you code here. Then run the commande with --functional option.

It is quite challenging for some part, but for the first days, it very pleasant to also try functional programming :)

$ bin/aoc solve --day=1 --functional
------------------------------------------ EXAMPLES  (FUNCTIONAL) ------------------------------------------
*  :  24000 - expected: 24000
** :  45000 - expected: 45000
------------------------------------------ OUTPUT  (FUNCTIONAL) ------------------------------------------
*  : 100000 - [0s] - [2.2MB]
** : 200000 - [0s] - [2.2MB]

adventofcode-template's People

Contributors

velkuns avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.