Giter Club home page Giter Club logo

aoc2023's Introduction

AoC 2023

Based on @davekch's template

Templates, utilitites and download-script

Download today's puzzle input from adventofcode, create a directory for this day and some template files to solve the puzzle in a given language. Includes templates and utility libraries for the following languages:

  • python
  • julia
  • haskell
  • C++

Requirements

  • python3
  • requests (pip3 install requests)
  • if you want to get your puzzle input downloaded automatically,
    • log into adventofcode via your browser and get the content of the session cookie
    • in your terminal, do export AOC_SESSION=your-session-id

How to use

This repository can either be used as a template repository or as a submodule.

$ python3 init.py --help
usage: init.py [-h] [-d DAY] [-y YEAR] [-l LANGUAGE [LANGUAGE ...]]
               [--no-download]

optional arguments:
  -h, --help            show this help message and exit
  -d DAY, --day DAY
  -y YEAR, --year YEAR
  -l LANGUAGE [LANGUAGE ...], --language LANGUAGE [LANGUAGE ...]
  --no-download

If no day / year is given, the current date is used. language defaults to py.

The script creates a folder for the day in the current working directory and copies all files for the given language from templates/<language>/ into it.

For example, to solve today's problem in Julia, do

$ export AOC_SESSION=your-session-id
$ python3 init.py -l jl

Notes on languages

Python

Templates are in templates/py. Do pip install -e utils/py to install the utility module aoc.utility.

$ python init.py
$ cd dayXX
$ pytest   # pip install pytest
$ python solver.py

Julia

Templates are in templates/jl. Do ] dev utils/jl to make the utility module AoC available in your environment.

$ python init.py -l jl
$ cd dayXX
$ julia
julia> push!(LOAD_PATH, pwd())
julia> using Revise
julia> using Solver
julia> test()  # or test(1) or test(2)
julia> main()  # or main(1) or test(2)

Revise hot reloads code in Solver.jl, so code along and just keep your REPL running.

Haskell

Templates are in templates/hs

dependencies: cabal install split optparse-applicative raw-strings-qq vector parsec

$ python init.py -l hs
$ cd dayXX
$ ghc -i../utils/hs solver.hs
$ ./solver

Run tests with ./solver --test or in the repl:

$ ghci -i../utils/hs solver.hs
λ> test1
λ> test2

You can also run only part one or two with ./solver --part 1.

Utilities are in utils/hs

C++

requires cxxtest: sudo apt-get install cxxtest

Templates are in templates/cpp

$ python init.py -l cpp
$ cd dayXX
$ make test
$ make run

Utilities are in utils/cpp. cd utils/cpp; make to test Utils.cpp

aoc2023's People

Contributors

nikoladze avatar

Watchers

 avatar

aoc2023's Issues

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.