Add utils
This commit is contained in:
parent
b10010e459
commit
838f0dfd93
12
utils/new_day.sh
Executable file
12
utils/new_day.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
if [[ ! -e .git ]]; then
|
||||||
|
echo "Merci de se déplacer dans le répertoire approprié"
|
||||||
|
exit 0
|
||||||
|
fi;
|
||||||
|
|
||||||
|
YEAR=$(date +%Y)
|
||||||
|
DAY=$(date +%d)
|
||||||
|
FILENAME="${YEAR}/day${DAY}.py"
|
||||||
|
|
||||||
|
cp utils/template.py "$FILENAME"
|
||||||
|
sed -i "s/DAY/${DAY}/" "$FILENAME"
|
||||||
|
sed -i "s/YEAR/${YEAR}/" "$FILENAME"
|
26
utils/template.py
Executable file
26
utils/template.py
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
"""
|
||||||
|
Jour DAY du défi Advent Of Code pour l'année YEAR
|
||||||
|
"""
|
||||||
|
|
||||||
|
def read_sample():
|
||||||
|
"""récupère les entrées depuis le fichier texte correspondant"""
|
||||||
|
with open('inputs/dayDAY.txt', 'r') as f:
|
||||||
|
sample = f.read().split('\n')
|
||||||
|
sample = [int(i) for i in sample if i != '']
|
||||||
|
return sample
|
||||||
|
|
||||||
|
def part1(sample):
|
||||||
|
"""Partie 1 du défi"""
|
||||||
|
return NotImplementedError
|
||||||
|
|
||||||
|
def part2(sample):
|
||||||
|
"""Partie 2 du défi"""
|
||||||
|
return NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Fonction principale"""
|
||||||
|
sample = read_sample()
|
||||||
|
print(f"part1: {part1(sample)}")
|
||||||
|
print(f"part2: {part2(sample)}")
|
Loading…
Reference in New Issue
Block a user