CTF challenges from advent-of-code
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as interview prep, company training, university coursework, practice problems, a speed contest, or to challenge each other.
-- About page
npm installRuns today's challenge
npm startParameters
npm start -- [--year <year>] [--day <day>] If not present yet, create an index.js file under the challenges/ folder which will contain all the imports and exports for the years:
import * as challengesYYYY from './YYYY/index.js';
export {
challengesYYYY,
};DD: indicates the day in two digits format (e.g. 05, 12, etc.)
YYYY: indicates the year in four digits format (e.g. 2022)
Under the challenges/ folder, create a folder with the year number.
Inside the folder, create an index.js file which will contain all the imports and exports for the challenges:
import * as challengeDD from './challenge-DD.js';
export {
challengeDD,
};Once created, add imports and exports in the challenges/index.js file.
-
Add your inputs in the
inputs/folder (you may need to create it) under the correct year, where the file name is the day in two digits format (extension must be.txt) e.g.inputs/2022/01.txt -
Add challenge file into the
challenges/YYYY/folder in the following format:challenge-DD.js. -
Implement
partOneandpartTwofunctions - they should both accept a 'rows' input indicating the rows of the input file for that challenge. The functions should return the challenge hash. If needed, a second parameter indicating the raw input can be added. -
Make sure you are exporting the functions from step 3.
-
Import and export the challenge in your year index.js file under
challenges/YYYY/index.js
Automatically create a new file challenge for today
npm run newTodayCreate a new file challenge for a specific date and (optional) year
npm start -- --newDay <day> [--newYear <year>]Note:
challenges/index.jsandchallenges/<year>/index.jsfiles must already be present.
export const partOne = (rows) => {
return 'Hash for challenge one';
};
export const partTwo = (rows, raw) => {
return 'Hash for challenge two';
};