use_day: Create the files for an Advent of Code day

Description Usage Arguments Details Value

Description

Create the files for an Advent of Code day

Usage

1
2
3
use_day(day, year = 2018, open = interactive())

convert_clipboard_html_to_roxygen_md(input = clipr::read_clip())

Arguments

day

integer giving the day

open

whether to open the created files. Defaults to TRUE in an interactive R session.

input

html code copied from the Advent of Code website

Details

Creates a file for writing the functions to solve the problem: R/dayxx.R. The text of the challenge is downloaded and inserted into the roxygen block. One caveat is that you will have to manually add the markdown text for Part Two yourself. BYou can use convert_clipboard_html_to_roxygen_md() to make this easier. Once you can read the description, view the page source, copy the html for that part of the problem. Run this function to create a Roxygen version of the HTML.

Also, creates a placeholder file for the problem input: inst/inputxx.txt. Paste your input here.

Also, creates a file for unit tests: tests/testthat/test-dayxx.R. This is good place to test that the examples in the problem description work.

Finally, creates a solution file: inst/run-dayxx.R. You should download your personalized challenge input as inst/inputxx.txt. Your solution file should read in this file and apply your functions to it. Once your solution passes on the site, store it in R/data-solutions.R. Then the solution file can load in your previous answer, rerun your solution, and check whether your code no longer obtains the same solution.

Value

use_day() returns NULL. convert_clipboard_html_to_roxygen_md() invisibly returns the Roxygen markdown block. It also copies Roxygen markdown block onto the clipboard.


tjmahr/adventofcode18 documentation built on May 24, 2019, 4:10 p.m.