Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract example inputs for puzzle markdown #81

Open
thesamet opened this issue Feb 8, 2025 · 0 comments
Open

Extract example inputs for puzzle markdown #81

thesamet opened this issue Feb 8, 2025 · 0 comments

Comments

@thesamet
Copy link

thesamet commented Feb 8, 2025

When solving Advent of Code puzzles, a common repetitive task is manually copying example inputs from the puzzle's markdown file and saving them in the data/examples directory. This process can be tedious and error-prone.

Proposed Solution

Introduce a command that scans the puzzle text for example inputs and writes them to files in data/examples.

Detection Method:

Example inputs are always presented as code blocks (enclosed within triple backticks ```).
In case of multiple code blocks, some may contain outputs, diagrams, or other non-input content. To handle this, the command can prompt the user interactively to confirm which blocks should be saved.

Naming Convention:

If only one input is accepted, it should be saved as ${day}.txt.
If multiple inputs are extracted, they should be named ${day}-{part}.txt.

Expected Workflow

  • Run the command (e.g., cargo extract ${day}).
  • The tool scans the puzzle markdown file for code blocks.
  • If multiple blocks are found, the user is prompted to confirm which ones should be saved.
  • Selected example inputs are saved with appropriate filenames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant