This commit is contained in:
marcus@weifer.de 2022-12-14 10:37:36 +01:00
commit 37aa2d6c83
15 changed files with 1199 additions and 0 deletions

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,23 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="NonAsciiCharacters" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="mysql_connector_repackaged" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8Inspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
</list>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (AdventOfCode2015) (2)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/AdventOfCode2015.iml" filepath="$PROJECT_DIR$/.idea/AdventOfCode2015.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

25
base.py Normal file
View File

@ -0,0 +1,25 @@
file= ".txt"
def part_one(file):
input = open(file, 'r')
result = 0
print(f"Part 1: {result}")
def part_two(file):
input = open(file, 'r')
result = 0
print(f"Part 2: {result}")
part_one(file)
part_two(file)

36
day1.py Normal file
View File

@ -0,0 +1,36 @@
file = "day1.txt"
lines = []
with open(file) as input:
lines = input.readline()
def part_one(lines):
up = 0
down = 0
for char in lines:
if(char == "("):
up +=1
else:
down += 1
print(f"Part 1: {up - down}")
def part_two(lines):
up = 0
down = 0
counter = 0
for char in lines:
if((up - down) == -1):
print(f"Part 2: {counter}")
break
else:
counter += 1
if (char == "("):
up += 1
else:
down += 1
part_one(lines)
part_two(lines)

1
day1.txt Normal file

File diff suppressed because one or more lines are too long

35
day2.py Normal file
View File

@ -0,0 +1,35 @@
file = "day2.txt"
test = "1x1x10"
def part_one(file):
input = open(file, 'r')
result = 0
for line in input:
linesplit = list(map(int, line.split('x')))
d1 = 2 * linesplit[0] * linesplit[1]
d2 = 2 * linesplit[1] * linesplit[2]
d3 = 2 * linesplit[2] * linesplit[0]
lowest_side = [d1 / 2,d2 / 2,d3 / 2]
result += d1 + d2 + d3 + sorted(lowest_side)[0]
print(f"Part 1: {result}")
def part_two(file):
input = open(file, 'r')
result = 0
for line in input:
l, w, h = line.split('x')
l, w, h = int(l), int(w), int(h)
ribbon = 2 * min(l + w, w + h, h + l)
bow = l * w * h
result += ribbon + bow
print(f"Part 2: {result}")
part_one(file)
part_two(file)

1000
day2.txt Normal file

File diff suppressed because it is too large Load Diff

25
day3.py Normal file
View File

@ -0,0 +1,25 @@
file= ".txt"
def part_one(file):
input = open(file, 'r')
result = 0
print(f"Part 1: {result}")
def part_two(file):
input = open(file, 'r')
result = 0
print(f"Part 2: {result}")
part_one(file)
part_two(file)

1
day3.txt Normal file

File diff suppressed because one or more lines are too long

16
main.py Normal file
View File

@ -0,0 +1,16 @@
# This is a sample Python script.
# Press Umschalt+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Strg+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/