From the About page of 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 a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other.
current-status.mov
The file for the puzzle input must be located in the same directory as the solution and it must have the name advent-XX-input.txt
for Day XX
. Simply run python advent-XX.py
for Day XX
. The program will prompt you to enter either 1
or 2
for answers for Part 1 or Part 2 respectively. For example -
The Cyclomatic Complexity of the solutions can be found in the table below. It is a metric that can be used to calculate the complexity of a program. These values were calculated using radon
, which is a tool for Python to calculate code metrics.
Information about radon
's usage of it can be found here.
Solution | Complexity | Solution | Complexity | Solution | Complexity |
---|---|---|---|---|---|
Day 01 | A (3.25) |
Day 10 | A (3.14) |
Day 19 | A (4.88) |
Day 02 | A (3.67) |
Day 11 | A (4.89) |
Day 20 | B (5.88) |
Day 03 | A (2.25) |
Day 12 | A (3.14) |
Day 21 | A (3.00) |
Day 04 | A (4.00) |
Day 13 | A (4.00) |
Day 22 | A (4.00) |
Day 05 | A (4.60) |
Day 14 | A (4.00) |
Day 23 | A (2.75) |
Day 06 | A (3.00) |
Day 15 | A (2.67) |
Day 24 | A (4.14) |
Day 07 | A (2.71) |
Day 16 | A (3.71) |
Day 25 | A (2.00) |
Day 08 | A (3.60) |
Day 17 | A (4.44) |
||
Day 09 | A (3.75) |
Day 18 | A (3.25) |
The scores, sourced from the radon
documentation here, can be understood as follows -
CC Score | Rank | Risk |
---|---|---|
1 - 5 | A |
low - simple block |
6 - 10 | B |
low - well structured and stable block |
11 - 20 | C |
moderate - slightly complex block |
21 - 30 | D |
more than moderate - more complex block |
31 - 40 | E |
high - complex block, alarming |
41+ | F |
very high - error-prone, unstable block |