Git Product home page Git Product logo

adventofcode-2018's Introduction

Installation

Requirements

You will need typescript installed on your device

npm i -g typescript

Install dependencies

The dependencies are installed using yarn

yarn

Usage

Create files for a new day

The create script allow you to create the required files to start a new day resolution. You just need to use the create script with the day (1 to 24) you need as last parameter

yarn run create [day]

It will create a new folder in the src folder with the following files :

src
  - day[day]
    - lib.ts              # Common library to resolve the current day
    - lib.spec.ts         # Test file for the library
    - part1.ts            # The main file for the first part of today puzzle
    - part1.spec.ts       # The test file for the first part of today puzzle
    - part2.ts            # The main file for the second part of today puzzle
    - part2.spec.ts       # The test file for the second part of today puzzle

Additionnally, it will add two input files in the inputs folder :

inputs
  - [day]-1.txt           # The input data for the first puzzle of day [day]
  - [day]-2.txt           # The input data for the second puzzle of day [day]

Note : if your try to relaunch the creation script on a day already existing, it will ignore the creation and keep your current files

Launch today script

You can launch today both puzzle or individually depending on your needs

yarn run start [day]      # Will run both puzzle in a row
yarn run start:1 [day]    # Will run only puzzle 1
yarn run start:2 [day]    # Will run only puzzle 2

Launch tests

There are two modes for the tests : normal or watch. It will run tests on all your sources files.

yarn run test             # Will run tests and will quit
yarn run test:watch       # Will run tests in watch mode

Build typescript sources

Like we did in the tests, two modes are supported to build typescript sources : normal or watch. It will build all your source files.

yarn build build          # Will build sources and will quit
yarn build build:watch    # Will build sources in watch mode

Notes of the day discovering

Day 1

Puzzle 1

  • N/A

Puzzle 2

  • Usage of Array object to store the results found : ~14.5s
  • Usage of Set object to store the results found : ~0.02s

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.