Skip to content

Commit 44254cf

Browse files
authored
Rename Project Euler directories and other dependent changes (TheAlgorithms#3300)
* Rename all Project Euler directories: Reason: The change was done to maintain consistency throughout the directory and to keep all directories in sorted order. Due to the above change, some config files had to be modified: 'problem_22` -> `problem_022` * Update scripts to pad zeroes in PE directories
1 parent 2d7e08e commit 44254cf

File tree

177 files changed

+108
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+108
-112
lines changed

.github/workflows/codespell.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/setup-python@v2
1111
- run: pip install codespell
1212
- run: |
13-
SKIP="./.*,./other/dictionary.txt,./other/words,./project_euler/problem_22/p022_names.txt"
13+
SKIP="./.*,./other/dictionary.txt,./other/words,./project_euler/problem_022/p022_names.txt"
1414
codespell --ignore-words-list=ans,fo,followings,hist,iff,secant,som,tim --skip=$SKIP --quiet-level=2
1515
- name: Codespell comment
1616
if: ${{ failure() }}

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ repos:
4343
- id: codespell
4444
args:
4545
- --ignore-words-list=ans,fo,followings,hist,iff,secant,som,tim
46-
- --skip="./.*,./other/dictionary.txt,./other/words,./project_euler/problem_22/p022_names.txt"
46+
- --skip="./.*,./other/dictionary.txt,./other/words,./project_euler/problem_022/p022_names.txt"
4747
- --quiet-level=2
4848
exclude: |
4949
(?x)^(
5050
other/dictionary.txt |
5151
other/words |
52-
project_euler/problem_22/p022_names.txt
52+
project_euler/problem_022/p022_names.txt
5353
)$
5454
- repo: local
5555
hooks:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

project_euler/project_euler_answers.json

+100-100
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,103 @@
11
{
2-
"01": "233168",
3-
"02": "4613732",
4-
"03": "6857",
5-
"04": "906609",
6-
"05": "232792560",
7-
"06": "25164150",
8-
"07": "104743",
9-
"08": "23514624000",
10-
"09": "31875000",
11-
"10": "142913828922",
12-
"11": "70600674",
13-
"12": "76576500",
14-
"13": "5537376230",
15-
"14": "837799",
16-
"15": "137846528820",
17-
"16": "1366",
18-
"17": "21124",
19-
"18": "1074",
20-
"19": "171",
21-
"20": "648",
22-
"21": "31626",
23-
"22": "871198282",
24-
"23": "4179871",
25-
"24": "2783915460",
26-
"25": "4782",
27-
"26": "983",
28-
"27": "-59231",
29-
"28": "669171001",
30-
"29": "9183",
31-
"30": "443839",
32-
"31": "73682",
33-
"32": "45228",
34-
"33": "100",
35-
"34": "40730",
36-
"35": "55",
37-
"36": "872187",
38-
"37": "748317",
39-
"38": "932718654",
40-
"39": "840",
41-
"40": "210",
42-
"41": "7652413",
43-
"42": "162",
44-
"43": "16695334890",
45-
"44": "5482660",
46-
"45": "1533776805",
47-
"46": "5777",
48-
"47": "134043",
49-
"48": "9110846700",
50-
"49": "296962999629",
51-
"50": "997651",
52-
"51": "121313",
53-
"52": "142857",
54-
"53": "4075",
55-
"54": "376",
56-
"55": "249",
57-
"56": "972",
58-
"57": "153",
59-
"58": "26241",
60-
"59": "129448",
61-
"60": "26033",
62-
"61": "28684",
63-
"62": "127035954683",
64-
"63": "49",
65-
"64": "1322",
66-
"65": "272",
67-
"66": "661",
68-
"67": "7273",
69-
"68": "6531031914842725",
70-
"69": "510510",
71-
"70": "8319823",
72-
"71": "428570",
73-
"72": "303963552391",
74-
"73": "7295372",
75-
"74": "402",
76-
"75": "161667",
77-
"76": "190569291",
78-
"77": "71",
79-
"78": "55374",
80-
"79": "73162890",
81-
"80": "40886",
82-
"81": "427337",
83-
"82": "260324",
84-
"83": "425185",
85-
"84": "101524",
86-
"85": "2772",
87-
"86": "1818",
88-
"87": "1097343",
89-
"88": "7587457",
90-
"89": "743",
91-
"90": "1217",
92-
"91": "14234",
93-
"92": "8581146",
94-
"93": "1258",
95-
"94": "518408346",
96-
"95": "14316",
97-
"96": "24702",
98-
"97": "8739992577",
99-
"98": "18769",
100-
"99": "709",
2+
"001": "233168",
3+
"002": "4613732",
4+
"003": "6857",
5+
"004": "906609",
6+
"005": "232792560",
7+
"006": "25164150",
8+
"007": "104743",
9+
"008": "23514624000",
10+
"009": "31875000",
11+
"010": "142913828922",
12+
"011": "70600674",
13+
"012": "76576500",
14+
"013": "5537376230",
15+
"014": "837799",
16+
"015": "137846528820",
17+
"016": "1366",
18+
"017": "21124",
19+
"018": "1074",
20+
"019": "171",
21+
"020": "648",
22+
"021": "31626",
23+
"022": "871198282",
24+
"023": "4179871",
25+
"024": "2783915460",
26+
"025": "4782",
27+
"026": "983",
28+
"027": "-59231",
29+
"028": "669171001",
30+
"029": "9183",
31+
"030": "443839",
32+
"031": "73682",
33+
"032": "45228",
34+
"033": "100",
35+
"034": "40730",
36+
"035": "55",
37+
"036": "872187",
38+
"037": "748317",
39+
"038": "932718654",
40+
"039": "840",
41+
"040": "210",
42+
"041": "7652413",
43+
"042": "162",
44+
"043": "16695334890",
45+
"044": "5482660",
46+
"045": "1533776805",
47+
"046": "5777",
48+
"047": "134043",
49+
"048": "9110846700",
50+
"049": "296962999629",
51+
"050": "997651",
52+
"051": "121313",
53+
"052": "142857",
54+
"053": "4075",
55+
"054": "376",
56+
"055": "249",
57+
"056": "972",
58+
"057": "153",
59+
"058": "26241",
60+
"059": "129448",
61+
"060": "26033",
62+
"061": "28684",
63+
"062": "127035954683",
64+
"063": "49",
65+
"064": "1322",
66+
"065": "272",
67+
"066": "661",
68+
"067": "7273",
69+
"068": "6531031914842725",
70+
"069": "510510",
71+
"070": "8319823",
72+
"071": "428570",
73+
"072": "303963552391",
74+
"073": "7295372",
75+
"074": "402",
76+
"075": "161667",
77+
"076": "190569291",
78+
"077": "71",
79+
"078": "55374",
80+
"079": "73162890",
81+
"080": "40886",
82+
"081": "427337",
83+
"082": "260324",
84+
"083": "425185",
85+
"084": "101524",
86+
"085": "2772",
87+
"086": "1818",
88+
"087": "1097343",
89+
"088": "7587457",
90+
"089": "743",
91+
"090": "1217",
92+
"091": "14234",
93+
"092": "8581146",
94+
"093": "1258",
95+
"094": "518408346",
96+
"095": "14316",
97+
"096": "24702",
98+
"097": "8739992577",
99+
"098": "18769",
100+
"099": "709",
101101
"100": "756872327473",
102102
"101": "37076114526",
103103
"102": "228",
@@ -724,4 +724,4 @@
724724
"723": "1395793419248",
725725
"724": "18128250110",
726726
"725": "4598797036650685"
727-
}
727+
}

project_euler/validate_solutions.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,15 @@ def collect_solution_file_paths() -> List[pathlib.Path]:
3737
return solution_file_paths
3838

3939

40-
def expand_parameters(param: pathlib.Path) -> str:
41-
"""Expand parameters in pytest parametrize"""
42-
project_dirname = param.parent.name
43-
solution_filename = param.name
44-
return f"{project_dirname}/{solution_filename}"
45-
46-
4740
@pytest.mark.parametrize(
48-
"solution_path", collect_solution_file_paths(), ids=expand_parameters
41+
"solution_path",
42+
collect_solution_file_paths(),
43+
ids=lambda path: f"{path.parent.name}/{path.name}",
4944
)
5045
def test_project_euler(solution_path: pathlib.Path):
5146
"""Testing for all Project Euler solutions"""
52-
problem_number: str = solution_path.parent.name[8:] # problem_[extract his part]
47+
# problem_[extract this part] and pad it with zeroes for width 3
48+
problem_number: str = solution_path.parent.name[8:].zfill(3)
5349
expected: str = PROBLEM_ANSWERS[problem_number]
5450
solution_module = convert_path_to_module(solution_path)
5551
answer = str(solution_module.solution())

0 commit comments

Comments
 (0)