day-02-solution.R

#-------------------------------------------------------------------------------
# Load libraries
#-------------------------------------------------------------------------------

# Load the crud library
cat("\014")
devtools::load_all()
devtools::document()
devtools::test()

# Load external packages
pckgs <- c("here", "tidyverse", "magrittr")
adventofcode2017::ipak(pckgs)

# Data directory
DATA_DIR <- file.path(here::here(), "tests/testthat/data")

#-------------------------------------------------------------------------------
# Exercise Day 02-01 Solution
#-------------------------------------------------------------------------------

# Define the input string
inp_day_02_01 <- file.path(DATA_DIR, "input-day-02-01.txt")

inp_day_02_01 %>%
    adventofcode2017::get_range_txtfile(txt_file = .)

#-------------------------------------------------------------------------------
# Exercise Day 02-02 Solution
#-------------------------------------------------------------------------------

# Define the input string
inp_test_day_02_02 <- file.path(DATA_DIR, "input-day-02-02.txt")

inp_test_day_02_02 %>%
    adventofcode2017::get_even_divisor_txtfile(txt_file = .)
shamindras/adventofcode2017 documentation built on May 14, 2019, 7:37 a.m.