/advent_of_code

Algorithms and data structure with web scrapping

Primary LanguageHTMLMIT LicenseMIT

Advent of code

AdventOfCode License: MIT GitHub top Language GitHub commit activity

This is the most wonderful time of the year - Andy Williams

This repository is built on python that run with poetry making all configs that you need automatically: creates directories, scripts, request HTML page from Advent of Code site and downloaded in 'src/cached_html', taking 'input', 'sample file' from 'src/input' and send back 'result' to the AoC page and pass the day filling the input on to the page (the last part is on progress).

  1. Clone and cd to root project then: $ poetry install, then poetry shell to activate the environment;

  2. Two ways of run it when you need creating files and populate them with data:

    A. Automatically: go on Chrome Browser on Advent of Code and choose [GitHub] as a sign in option (only this method it is available for now).

    B. Manually: add input manually: input/{year}/day{day}.txt and input/{year}/day{day}_sample.txt.

    Note: If you want to use project with your own inputs and different approach in solving problems, you have to remove anything in directory 'py/', except 'script_example.txt'; then in directory 'src/' remove completely 'input/' and 'cached_html/'. Then add manually the input into the files as in 2.B step.

  3. Run: $python main.py -v <yearday> e.g: python main.py -v 2201 '22' represent year 2022 and '01' is day 01.

    If no year is mentioned, it will be taken automatically last year available: python main.py -v 01. In this case '22' is the last year available for 'day01'.

  4. Testing: For testing sample input add '-s s': python main.py -v 2201 -s s

Day Name Solution Part 1 Part 2 Stars
01 Calorie Counting py 66487 197301 **
02 Rock Paper Scissors py 13446 13509 **
03 Rucksack Reorganization py 8053 2425 **
04 Camp Cleanup py 433 852 **
05 Supply Stacks py JRVNHHCSJ GNFBSBJLH **
06 Turning Trouble py 1287 3716 **
07 No Space Left On Device py 1367870 549173 **
08 Treetop Tree House py 1533 345744 **
09 py
10 py
11 py
12 py
13 py
14 py
15 py
16 py
17 py
18 py
19 py
20 py
21 py
22 py
23 py
24 py
25 py

Changelog (see GitHub issues):

  • #1 Poetry environment
  • #2 Run script from command line v0.1
  • #3 Refactor day 01 - 04 to run with command line now
  • #4 Refactor run command line v0.2 to accept more functions
  • #7 Refactor day 01-07 to run with command line v2
  • #9 Automate scripts and input file
  • #10 Get input data from AoC in HTML format
  • #16 Cache AOC's HTML storyline and input
  • #17 Migrate project from functions to classes (bonus: coloured print)
  • Test methods

TO DO'S:

1. find a pattern to automate downloading multiple examples when given and chose the right one required for testing solution