Giter VIP home page Giter VIP logo

aoc-2021's Introduction

Advent of Code Java Starter project

A project to get you started solving the Advent of Code 2018 challenge in Java.

Architecture

The Main method in App will execute the code for a given day based on input in src/main/resources/day[number].txt

The given Day class will process the input and return a result, which App will print to stdout.

Assumptions

  1. Each day's puzzle will have an input consisting of one or more lines of plain text.
  2. Each day's puzzle will have two "parts" requiring separate implementations, but using the same input.
  3. Puzzle solutions will be a single line of text.
  4. Each puzzle description will provide at least one example input/output.

How to add a puzzle

The shell for day 1 is already there. These are the steps to add day 2, etc. For day 1 you can start by writing the test cases once the puzzle posts.

Part 1

  1. Create aoc.day02.Day02.java implements Day
  2. Add a line to the static initialization block in App.java to add your nwe Day implementation: DAYS.put(2, new Day02())
  3. Create Day02Test.java and use the sample input/output from adventofcode.com/2019/day/2 to write tests (they will initially fail).
  4. Implement Day02.part1() until the tests pass (Test Driven Development!). You can run ./gradlew --continuous check to have the tests run every time you save your code.
  5. When the example input passes, get your solution from adventofcode.com/2019/day/2/input and save it as src/main/resources/day02.txt
  6. Run ./gradlew clean build install && ./build/install/advent-of-code/bin/advent-of-code 2 to get your output.
    • Notice the day number ("2") is passed to the start script as an argument.
  7. Check your solution on adventofcode.com!

Part 2

  1. Add new tests for part 2 to Day02Test.java using the sample input/output from adventofcode.com/2019/day/2
  2. Implement Day02.part2() until the tests pass.
  3. When the example input passes, run ./gradlew clean build install && ./build/install/advent-of-code/bin/advent-of-code 2 2 to get your output.
    • Notice the second argument to the script is the part number. It defaults to 1, so now you have to pass it as 2.
  4. Check your solution on adventofcode.com!

aoc-2021's People

Contributors

gczarnocki avatar

Watchers

James Cloos 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.