Skip to content

Kevincav/AdventOfCode2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License Advent of Code


Logo

Advent of Code Scala Solutions

A useful library I use to get started coding with Advent of Code

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Rate Limiter
  5. Roadmap
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgments

About The Project

This project is a framework for scala users to easily get started with Advent of Code submissions.

(back to top)

Built With

Scala
Github-Actions

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

  • java

    brew install openjdk
  • scala

    brew install scala
  • Fetch your Advent of Code Session Cookie

  • Set your cookie session

    echo 'export AOC_COOKIE_SESSION="<cookie session>"' >> ~/.zshrc
  • Set your user agent

    echo 'export AOC_USER_AGENT="https://github.com/yourrepo/AdventOfCode by [email protected]"' >> ~/.zshrc
  • Set the flag to submit answers programmatically

    echo 'export AOC_SUBMIT_ANSWERS=true' >> ~/.zshrc
  • Set the throttle flag

    echo 'export AOC_SUBMISSION_THROTTLE=5' >> ~/.zshrc

(back to top)

Installation

  1. Clone the repo
    git clone https://github.com/Kevincav/AdventOfCode2024.git
  2. Change git remote url to avoid accidental pushes to base project
    git remote set-url origin Kevincav/AdventOfCode2024
    git remote -v # confirm the changes

(back to top)

Usage

Setting up for a new AoC day

  1. Run the Github Action File Downloader (This action should run at midnight every day from Dec 1st - 25th)

  2. Pull the newest version of the code

     git pull

(back to top)

Building your solution

  1. Parse your input into the needed data type for the run and add that to the setup function
  2. Write the code for solution 1 and add that to the solution1 function
  3. Write the code for solution 2 and add that to the solution2 function

(back to top)

Testing your solution

  1. Run the days solutions with the example data
    sbt 'testOnly *org.advent.year{year}.Day{day}Test' 

(back to top)

Submitting your changes and grabbing solution results

  1. Make your changes
    git add .
    git commit -am "I have made some changes."
    
  2. Push your commit
    git push origin develop
    
  3. Check your most recent actions run for details

(back to top)

Rate Limiter

This repo/tool does follow the automation guidelines on the /r/adventofcode community wiki. Specifically:

  1. Outbound calls are throttled to every N minutes (defined by environmental variable AOC_SUBMISSION_THROTTLE) in pushAnswer()
  2. Automated submissions can be turned off by setting the environmental variable AOC_SUBMIT_ANSWERS to false
  3. Solution inputs are downloaded and committed daily at midnight through GitHub Actions (only December 1-25 every year)
  4. Once inputs are downloaded, they are cached locally in src/main/resources
  5. If you suspect your input is corrupted, you can manually request a fresh copy by running the input-aoc-solution-data GitHub Action
  6. The User-Agent header is set through GitHub Action Secrets

(back to top)

Roadmap

  • Setup API / REST call to submit answers for the day (instead of manual submissions)
  • Setup Rate Limiter for REST submission

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Top contributors:

contrib.rocks image

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Project Link: https://github.com/Kevincav/AdventOfCode2024

(back to top)

Acknowledgments

(back to top)

About

Advent of Code 2024 Scala

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published