Giter VIP home page Giter VIP logo

advent-of-code-starter's Introduction

πŸŽ„ Advent of Code Starter 🌟

This repository provides starting code to get you set up for completing Advent of Code puzzles using JavaScript.

Quick Start

For comprehensive instructions, see Setting Up a Complete Project.

  1. Copy template.js.
  2. Modify function process(input) { } in the newly copied file.
  3. Save your puzzle input to a text file.
  4. Run your JavaScript file passing -f followed by the text file containing the puzzle input.

Setting Up a Complete Project

  1. Fork this reposity to your computer
  2. Create a folder named after the current year.
  • This folder will be referred to as the YEAR directory in these instructions.
  1. Save your puzzle input (accessable from the Daily Puzzle page (sample) in a new file in a new folder called YEAR/input.
  • It is recommended to name the file after the date. For example, for 2022 Day 01, save the puzzle input in 2022/input/01.txt
  • You can save the puzzle input by pressing Ctrl+S on the input page (sample) or by creating a new text file and pasting in the input data.
    • Hint: if copying and pasting, be sure you are using UNIX ecoding for proper \n usage.
  1. Copy template.js to a new file named after the date in the year directory.
  • You will need to update the import statement from require("./util/inputParser") to require("../util/inputParser")
  • For example, for 2022 day 01, copy template.js to 2022/01.js
  1. Write your solution code in process(input).
  2. Run to see the result with node YEAR/JAVASCRIPT_FILE_NAME -f YEAR/input/DATA_FILE_NAME.txt!
  • For example, for 2022 day 01, run node 2022/01 -f 2022/input/01.txt.
  • Alternatively, hardcode the path to file in the cliInput.load() call for the file. For example, cliInput.load("2022/input/01.txt") for 2022 day 01.
  • The output is what you will submit on the Advent of Code page.

Your final project structure will look like this:

project
β”‚   template.js
β”‚   ... (starting files)
β”‚
└───2022
    β”‚   01.js
    β”‚   ... (other solution files)
    β”‚
    └───input
        β”‚   01.txt
        β”‚   ... (other input files)

Command-line Options

Flags (modify inputParser.load()'s result)

  • -f PATH/TO/FILE: Parses PATH/TO/FILE's contents and into inputParser.load()'s .then() callback.
  • -t "SAMPLE INPUT": Passes the string "SAMPLE INPUT" into inputParser.load()'s .then() callback. Useful for debugging (you can use a smaller input to test functionality).
  • -d: Enable debug mode, which will output information about the data being processed

advent-of-code-starter's People

Watchers

 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.