init
This commit is contained in:
commit
37aa2d6c83
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
10
.idea/AdventOfCode2015.iml
Normal file
10
.idea/AdventOfCode2015.iml
Normal 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>
|
23
.idea/inspectionProfiles/Project_Default.xml
Normal file
23
.idea/inspectionProfiles/Project_Default.xml
Normal 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>
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal 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
4
.idea/misc.xml
Normal 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
8
.idea/modules.xml
Normal 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
6
.idea/vcs.xml
Normal 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
25
base.py
Normal 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
36
day1.py
Normal 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)
|
35
day2.py
Normal file
35
day2.py
Normal 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)
|
25
day3.py
Normal file
25
day3.py
Normal 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)
|
16
main.py
Normal file
16
main.py
Normal 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/
|
Loading…
Reference in New Issue
Block a user