From 8596c316cfb60b823c76d43c58b0133fc9b16996 Mon Sep 17 00:00:00 2001 From: TiagoRG Date: Mon, 5 Jun 2023 22:09:32 +0100 Subject: [PATCH] Reorganized the repository --- {days1-5 => 2022}/day1/day1.py | 0 {days1-5 => 2022}/day1/input.txt | 0 {days1-5 => 2022}/day2/day2_part1.py | 0 {days1-5 => 2022}/day2/day2_part2.py | 0 {days1-5 => 2022}/day2/input.txt | 0 .../day3/.idea/.idea.Day3/.idea/.gitignore | 0 .../day3/.idea/.idea.Day3/.idea/.name | 0 .../day3/.idea/.idea.Day3/.idea/discord.xml | 0 .../.idea/.idea.Day3/.idea/indexLayout.xml | 0 .../day3/.idea/.idea.Day3/.idea/vcs.xml | 0 {days1-5 => 2022}/day3/Day3.csproj | 0 {days1-5 => 2022}/day3/Day3.sln | 0 {days1-5 => 2022}/day3/Part1.cs | 0 {days1-5 => 2022}/day3/Part2.cs | 0 {days1-5 => 2022}/day3/Program.cs | 0 {days1-5 => 2022}/day3/bin/Debug/net6.0/Day3 | Bin .../day3/bin/Debug/net6.0/Day3.deps.json | 0 .../day3/bin/Debug/net6.0/Day3.dll | Bin .../day3/bin/Debug/net6.0/Day3.pdb | Bin .../bin/Debug/net6.0/Day3.runtimeconfig.json | 0 .../day3/bin/Debug/net6.0/input.txt | 0 .../day3/bin/Debug/net6.0/ref/Day3.dll | Bin .../day3/obj/Day3.csproj.nuget.dgspec.json | 0 .../day3/obj/Day3.csproj.nuget.g.props | 0 .../day3/obj/Day3.csproj.nuget.g.targets | 0 ...CoreApp,Version=v6.0.AssemblyAttributes.cs | 0 .../obj/Debug/net6.0/Day3.AssemblyInfo.cs | 0 .../net6.0/Day3.AssemblyInfoInputs.cache | 0 ....GeneratedMSBuildEditorConfig.editorconfig | 0 .../obj/Debug/net6.0/Day3.GlobalUsings.g.cs | 0 .../day3/obj/Debug/net6.0/Day3.assets.cache | Bin .../Day3.csproj.AssemblyReference.cache | Bin .../Day3.csproj.CoreCompileInputs.cache | 0 .../net6.0/Day3.csproj.FileListAbsolute.txt | 0 .../day3/obj/Debug/net6.0/Day3.dll | Bin .../Debug/net6.0/Day3.genruntimeconfig.cache | 0 .../day3/obj/Debug/net6.0/Day3.pdb | Bin .../day3/obj/Debug/net6.0/apphost | Bin .../day3/obj/Debug/net6.0/ref/Day3.dll | Bin .../day3/obj/project.assets.json | 0 .../day3/obj/project.nuget.cache | 0 .../day3/obj/project.packagespec.json | 0 .../day3/obj/rider.project.restore.info | 0 {days1-5 => 2022}/day4/day4.py | 0 {days1-5 => 2022}/day4/input.txt | 0 {days1-5 => 2022}/day5/day5.py | 0 {days1-5 => 2022}/day5/input.txt | 0 {days6-10 => 2022}/day6/day6_part1.py | 0 {days6-10 => 2022}/day6/day6_part2.py | 0 {days6-10 => 2022}/day6/input.txt | 0 2022/day7/day7.py | 25 + 2022/day7/input.txt | 1087 +++++++++ .../day8/__pycache__/load_map.cpython-311.pyc | Bin {days6-10 => 2022}/day8/day8_part1.py | 0 {days6-10 => 2022}/day8/day8_part2.py | 0 {days6-10 => 2022}/day8/input.txt | 0 {days6-10 => 2022}/day8/load_map.py | 0 2022/day9/day9_part1.py | 99 + 2022/day9/input.txt | 2000 +++++++++++++++++ README.md | 22 +- day-selector.py | 29 - 61 files changed, 3220 insertions(+), 42 deletions(-) rename {days1-5 => 2022}/day1/day1.py (100%) rename {days1-5 => 2022}/day1/input.txt (100%) rename {days1-5 => 2022}/day2/day2_part1.py (100%) rename {days1-5 => 2022}/day2/day2_part2.py (100%) rename {days1-5 => 2022}/day2/input.txt (100%) rename {days1-5 => 2022}/day3/.idea/.idea.Day3/.idea/.gitignore (100%) rename {days1-5 => 2022}/day3/.idea/.idea.Day3/.idea/.name (100%) rename {days1-5 => 2022}/day3/.idea/.idea.Day3/.idea/discord.xml (100%) rename {days1-5 => 2022}/day3/.idea/.idea.Day3/.idea/indexLayout.xml (100%) rename {days1-5 => 2022}/day3/.idea/.idea.Day3/.idea/vcs.xml (100%) rename {days1-5 => 2022}/day3/Day3.csproj (100%) rename {days1-5 => 2022}/day3/Day3.sln (100%) rename {days1-5 => 2022}/day3/Part1.cs (100%) rename {days1-5 => 2022}/day3/Part2.cs (100%) rename {days1-5 => 2022}/day3/Program.cs (100%) rename {days1-5 => 2022}/day3/bin/Debug/net6.0/Day3 (100%) rename {days1-5 => 2022}/day3/bin/Debug/net6.0/Day3.deps.json (100%) rename {days1-5 => 2022}/day3/bin/Debug/net6.0/Day3.dll (100%) rename {days1-5 => 2022}/day3/bin/Debug/net6.0/Day3.pdb (100%) rename {days1-5 => 2022}/day3/bin/Debug/net6.0/Day3.runtimeconfig.json (100%) rename {days1-5 => 2022}/day3/bin/Debug/net6.0/input.txt (100%) rename {days1-5 => 2022}/day3/bin/Debug/net6.0/ref/Day3.dll (100%) rename {days1-5 => 2022}/day3/obj/Day3.csproj.nuget.dgspec.json (100%) rename {days1-5 => 2022}/day3/obj/Day3.csproj.nuget.g.props (100%) rename {days1-5 => 2022}/day3/obj/Day3.csproj.nuget.g.targets (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.AssemblyInfo.cs (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.AssemblyInfoInputs.cache (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.GeneratedMSBuildEditorConfig.editorconfig (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.GlobalUsings.g.cs (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.assets.cache (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.csproj.AssemblyReference.cache (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.csproj.CoreCompileInputs.cache (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.csproj.FileListAbsolute.txt (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.dll (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.genruntimeconfig.cache (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/Day3.pdb (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/apphost (100%) rename {days1-5 => 2022}/day3/obj/Debug/net6.0/ref/Day3.dll (100%) rename {days1-5 => 2022}/day3/obj/project.assets.json (100%) rename {days1-5 => 2022}/day3/obj/project.nuget.cache (100%) rename {days1-5 => 2022}/day3/obj/project.packagespec.json (100%) rename {days1-5 => 2022}/day3/obj/rider.project.restore.info (100%) rename {days1-5 => 2022}/day4/day4.py (100%) rename {days1-5 => 2022}/day4/input.txt (100%) rename {days1-5 => 2022}/day5/day5.py (100%) rename {days1-5 => 2022}/day5/input.txt (100%) rename {days6-10 => 2022}/day6/day6_part1.py (100%) rename {days6-10 => 2022}/day6/day6_part2.py (100%) rename {days6-10 => 2022}/day6/input.txt (100%) create mode 100644 2022/day7/day7.py create mode 100644 2022/day7/input.txt rename {days6-10 => 2022}/day8/__pycache__/load_map.cpython-311.pyc (100%) rename {days6-10 => 2022}/day8/day8_part1.py (100%) rename {days6-10 => 2022}/day8/day8_part2.py (100%) rename {days6-10 => 2022}/day8/input.txt (100%) rename {days6-10 => 2022}/day8/load_map.py (100%) create mode 100644 2022/day9/day9_part1.py create mode 100644 2022/day9/input.txt delete mode 100644 day-selector.py diff --git a/days1-5/day1/day1.py b/2022/day1/day1.py similarity index 100% rename from days1-5/day1/day1.py rename to 2022/day1/day1.py diff --git a/days1-5/day1/input.txt b/2022/day1/input.txt similarity index 100% rename from days1-5/day1/input.txt rename to 2022/day1/input.txt diff --git a/days1-5/day2/day2_part1.py b/2022/day2/day2_part1.py similarity index 100% rename from days1-5/day2/day2_part1.py rename to 2022/day2/day2_part1.py diff --git a/days1-5/day2/day2_part2.py b/2022/day2/day2_part2.py similarity index 100% rename from days1-5/day2/day2_part2.py rename to 2022/day2/day2_part2.py diff --git a/days1-5/day2/input.txt b/2022/day2/input.txt similarity index 100% rename from days1-5/day2/input.txt rename to 2022/day2/input.txt diff --git a/days1-5/day3/.idea/.idea.Day3/.idea/.gitignore b/2022/day3/.idea/.idea.Day3/.idea/.gitignore similarity index 100% rename from days1-5/day3/.idea/.idea.Day3/.idea/.gitignore rename to 2022/day3/.idea/.idea.Day3/.idea/.gitignore diff --git a/days1-5/day3/.idea/.idea.Day3/.idea/.name b/2022/day3/.idea/.idea.Day3/.idea/.name similarity index 100% rename from days1-5/day3/.idea/.idea.Day3/.idea/.name rename to 2022/day3/.idea/.idea.Day3/.idea/.name diff --git a/days1-5/day3/.idea/.idea.Day3/.idea/discord.xml b/2022/day3/.idea/.idea.Day3/.idea/discord.xml similarity index 100% rename from days1-5/day3/.idea/.idea.Day3/.idea/discord.xml rename to 2022/day3/.idea/.idea.Day3/.idea/discord.xml diff --git a/days1-5/day3/.idea/.idea.Day3/.idea/indexLayout.xml b/2022/day3/.idea/.idea.Day3/.idea/indexLayout.xml similarity index 100% rename from days1-5/day3/.idea/.idea.Day3/.idea/indexLayout.xml rename to 2022/day3/.idea/.idea.Day3/.idea/indexLayout.xml diff --git a/days1-5/day3/.idea/.idea.Day3/.idea/vcs.xml b/2022/day3/.idea/.idea.Day3/.idea/vcs.xml similarity index 100% rename from days1-5/day3/.idea/.idea.Day3/.idea/vcs.xml rename to 2022/day3/.idea/.idea.Day3/.idea/vcs.xml diff --git a/days1-5/day3/Day3.csproj b/2022/day3/Day3.csproj similarity index 100% rename from days1-5/day3/Day3.csproj rename to 2022/day3/Day3.csproj diff --git a/days1-5/day3/Day3.sln b/2022/day3/Day3.sln similarity index 100% rename from days1-5/day3/Day3.sln rename to 2022/day3/Day3.sln diff --git a/days1-5/day3/Part1.cs b/2022/day3/Part1.cs similarity index 100% rename from days1-5/day3/Part1.cs rename to 2022/day3/Part1.cs diff --git a/days1-5/day3/Part2.cs b/2022/day3/Part2.cs similarity index 100% rename from days1-5/day3/Part2.cs rename to 2022/day3/Part2.cs diff --git a/days1-5/day3/Program.cs b/2022/day3/Program.cs similarity index 100% rename from days1-5/day3/Program.cs rename to 2022/day3/Program.cs diff --git a/days1-5/day3/bin/Debug/net6.0/Day3 b/2022/day3/bin/Debug/net6.0/Day3 similarity index 100% rename from days1-5/day3/bin/Debug/net6.0/Day3 rename to 2022/day3/bin/Debug/net6.0/Day3 diff --git a/days1-5/day3/bin/Debug/net6.0/Day3.deps.json b/2022/day3/bin/Debug/net6.0/Day3.deps.json similarity index 100% rename from days1-5/day3/bin/Debug/net6.0/Day3.deps.json rename to 2022/day3/bin/Debug/net6.0/Day3.deps.json diff --git a/days1-5/day3/bin/Debug/net6.0/Day3.dll b/2022/day3/bin/Debug/net6.0/Day3.dll similarity index 100% rename from days1-5/day3/bin/Debug/net6.0/Day3.dll rename to 2022/day3/bin/Debug/net6.0/Day3.dll diff --git a/days1-5/day3/bin/Debug/net6.0/Day3.pdb b/2022/day3/bin/Debug/net6.0/Day3.pdb similarity index 100% rename from days1-5/day3/bin/Debug/net6.0/Day3.pdb rename to 2022/day3/bin/Debug/net6.0/Day3.pdb diff --git a/days1-5/day3/bin/Debug/net6.0/Day3.runtimeconfig.json b/2022/day3/bin/Debug/net6.0/Day3.runtimeconfig.json similarity index 100% rename from days1-5/day3/bin/Debug/net6.0/Day3.runtimeconfig.json rename to 2022/day3/bin/Debug/net6.0/Day3.runtimeconfig.json diff --git a/days1-5/day3/bin/Debug/net6.0/input.txt b/2022/day3/bin/Debug/net6.0/input.txt similarity index 100% rename from days1-5/day3/bin/Debug/net6.0/input.txt rename to 2022/day3/bin/Debug/net6.0/input.txt diff --git a/days1-5/day3/bin/Debug/net6.0/ref/Day3.dll b/2022/day3/bin/Debug/net6.0/ref/Day3.dll similarity index 100% rename from days1-5/day3/bin/Debug/net6.0/ref/Day3.dll rename to 2022/day3/bin/Debug/net6.0/ref/Day3.dll diff --git a/days1-5/day3/obj/Day3.csproj.nuget.dgspec.json b/2022/day3/obj/Day3.csproj.nuget.dgspec.json similarity index 100% rename from days1-5/day3/obj/Day3.csproj.nuget.dgspec.json rename to 2022/day3/obj/Day3.csproj.nuget.dgspec.json diff --git a/days1-5/day3/obj/Day3.csproj.nuget.g.props b/2022/day3/obj/Day3.csproj.nuget.g.props similarity index 100% rename from days1-5/day3/obj/Day3.csproj.nuget.g.props rename to 2022/day3/obj/Day3.csproj.nuget.g.props diff --git a/days1-5/day3/obj/Day3.csproj.nuget.g.targets b/2022/day3/obj/Day3.csproj.nuget.g.targets similarity index 100% rename from days1-5/day3/obj/Day3.csproj.nuget.g.targets rename to 2022/day3/obj/Day3.csproj.nuget.g.targets diff --git a/days1-5/day3/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs b/2022/day3/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs rename to 2022/day3/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.AssemblyInfo.cs b/2022/day3/obj/Debug/net6.0/Day3.AssemblyInfo.cs similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.AssemblyInfo.cs rename to 2022/day3/obj/Debug/net6.0/Day3.AssemblyInfo.cs diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.AssemblyInfoInputs.cache b/2022/day3/obj/Debug/net6.0/Day3.AssemblyInfoInputs.cache similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.AssemblyInfoInputs.cache rename to 2022/day3/obj/Debug/net6.0/Day3.AssemblyInfoInputs.cache diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.GeneratedMSBuildEditorConfig.editorconfig b/2022/day3/obj/Debug/net6.0/Day3.GeneratedMSBuildEditorConfig.editorconfig similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.GeneratedMSBuildEditorConfig.editorconfig rename to 2022/day3/obj/Debug/net6.0/Day3.GeneratedMSBuildEditorConfig.editorconfig diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.GlobalUsings.g.cs b/2022/day3/obj/Debug/net6.0/Day3.GlobalUsings.g.cs similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.GlobalUsings.g.cs rename to 2022/day3/obj/Debug/net6.0/Day3.GlobalUsings.g.cs diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.assets.cache b/2022/day3/obj/Debug/net6.0/Day3.assets.cache similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.assets.cache rename to 2022/day3/obj/Debug/net6.0/Day3.assets.cache diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.csproj.AssemblyReference.cache b/2022/day3/obj/Debug/net6.0/Day3.csproj.AssemblyReference.cache similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.csproj.AssemblyReference.cache rename to 2022/day3/obj/Debug/net6.0/Day3.csproj.AssemblyReference.cache diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.csproj.CoreCompileInputs.cache b/2022/day3/obj/Debug/net6.0/Day3.csproj.CoreCompileInputs.cache similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.csproj.CoreCompileInputs.cache rename to 2022/day3/obj/Debug/net6.0/Day3.csproj.CoreCompileInputs.cache diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.csproj.FileListAbsolute.txt b/2022/day3/obj/Debug/net6.0/Day3.csproj.FileListAbsolute.txt similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.csproj.FileListAbsolute.txt rename to 2022/day3/obj/Debug/net6.0/Day3.csproj.FileListAbsolute.txt diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.dll b/2022/day3/obj/Debug/net6.0/Day3.dll similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.dll rename to 2022/day3/obj/Debug/net6.0/Day3.dll diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.genruntimeconfig.cache b/2022/day3/obj/Debug/net6.0/Day3.genruntimeconfig.cache similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.genruntimeconfig.cache rename to 2022/day3/obj/Debug/net6.0/Day3.genruntimeconfig.cache diff --git a/days1-5/day3/obj/Debug/net6.0/Day3.pdb b/2022/day3/obj/Debug/net6.0/Day3.pdb similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/Day3.pdb rename to 2022/day3/obj/Debug/net6.0/Day3.pdb diff --git a/days1-5/day3/obj/Debug/net6.0/apphost b/2022/day3/obj/Debug/net6.0/apphost similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/apphost rename to 2022/day3/obj/Debug/net6.0/apphost diff --git a/days1-5/day3/obj/Debug/net6.0/ref/Day3.dll b/2022/day3/obj/Debug/net6.0/ref/Day3.dll similarity index 100% rename from days1-5/day3/obj/Debug/net6.0/ref/Day3.dll rename to 2022/day3/obj/Debug/net6.0/ref/Day3.dll diff --git a/days1-5/day3/obj/project.assets.json b/2022/day3/obj/project.assets.json similarity index 100% rename from days1-5/day3/obj/project.assets.json rename to 2022/day3/obj/project.assets.json diff --git a/days1-5/day3/obj/project.nuget.cache b/2022/day3/obj/project.nuget.cache similarity index 100% rename from days1-5/day3/obj/project.nuget.cache rename to 2022/day3/obj/project.nuget.cache diff --git a/days1-5/day3/obj/project.packagespec.json b/2022/day3/obj/project.packagespec.json similarity index 100% rename from days1-5/day3/obj/project.packagespec.json rename to 2022/day3/obj/project.packagespec.json diff --git a/days1-5/day3/obj/rider.project.restore.info b/2022/day3/obj/rider.project.restore.info similarity index 100% rename from days1-5/day3/obj/rider.project.restore.info rename to 2022/day3/obj/rider.project.restore.info diff --git a/days1-5/day4/day4.py b/2022/day4/day4.py similarity index 100% rename from days1-5/day4/day4.py rename to 2022/day4/day4.py diff --git a/days1-5/day4/input.txt b/2022/day4/input.txt similarity index 100% rename from days1-5/day4/input.txt rename to 2022/day4/input.txt diff --git a/days1-5/day5/day5.py b/2022/day5/day5.py similarity index 100% rename from days1-5/day5/day5.py rename to 2022/day5/day5.py diff --git a/days1-5/day5/input.txt b/2022/day5/input.txt similarity index 100% rename from days1-5/day5/input.txt rename to 2022/day5/input.txt diff --git a/days6-10/day6/day6_part1.py b/2022/day6/day6_part1.py similarity index 100% rename from days6-10/day6/day6_part1.py rename to 2022/day6/day6_part1.py diff --git a/days6-10/day6/day6_part2.py b/2022/day6/day6_part2.py similarity index 100% rename from days6-10/day6/day6_part2.py rename to 2022/day6/day6_part2.py diff --git a/days6-10/day6/input.txt b/2022/day6/input.txt similarity index 100% rename from days6-10/day6/input.txt rename to 2022/day6/input.txt diff --git a/2022/day7/day7.py b/2022/day7/day7.py new file mode 100644 index 0000000..16225b2 --- /dev/null +++ b/2022/day7/day7.py @@ -0,0 +1,25 @@ +def main(): + directory_contents = {} + with open('input.txt', 'r') as f: + input_lines = f.readlines() + + line_index = 0 + while line_index < len(input_lines): + if input_lines[line_index].startswith('$ cd'): + if input_lines[line_index][5:] not in ['..', '/']: + directory_contents[input_lines[line_index][5:]] = [] + line_index += 1 + continue + elif input_lines[line_index].startswith('$ ls'): + line_index += 1 + while not input_lines[line_index].startswith('$'): + ... + + +def current_dir_size(dir: str) -> int: + ... + + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/2022/day7/input.txt b/2022/day7/input.txt new file mode 100644 index 0000000..e60b95e --- /dev/null +++ b/2022/day7/input.txt @@ -0,0 +1,1087 @@ +$ cd / +$ ls +dir fwbjchs +dir hmnpr +dir jtrbrcjl +dir lcgv +dir ldqc +dir vrvl +$ cd fwbjchs +$ ls +154619 wqdlv.mdw +21648 wvbnz +$ cd .. +$ cd hmnpr +$ ls +178623 rftqqsrp.bfm +$ cd .. +$ cd jtrbrcjl +$ ls +dir nmbfwc +dir whqb +$ cd nmbfwc +$ ls +242645 lcgv +256365 wdzw.drg +$ cd .. +$ cd whqb +$ ls +161522 mrqgpv.gsm +48062 vpsgcl.gfh +$ cd .. +$ cd .. +$ cd lcgv +$ ls +dir cthtlwds +dir grldv +dir lnztfr +dir vwhf +dir znmzg +$ cd cthtlwds +$ ls +dir dghvw +dir tfwgg +$ cd dghvw +$ ls +107090 jmj.lzh +$ cd .. +$ cd tfwgg +$ ls +dir ddnfmsjc +252616 fvj +dir gng +dir lcgv +234528 mpb +181198 pzqgf.cjd +dir svvz +$ cd ddnfmsjc +$ ls +dir hwmcsdvt +dir lcgv +$ cd hwmcsdvt +$ ls +208912 wdzw.drg +$ cd .. +$ cd lcgv +$ ls +47252 tnd.ztd +$ cd .. +$ cd .. +$ cd gng +$ ls +44313 pzqgf.cjd +$ cd .. +$ cd lcgv +$ ls +182616 wdzw.drg +$ cd .. +$ cd svvz +$ ls +86968 sqtggfv +33927 vfmltgs +$ cd .. +$ cd .. +$ cd .. +$ cd grldv +$ ls +145761 mrqgpv.gsm +dir wqdlv +$ cd wqdlv +$ ls +96902 jhmsp +157064 mrqgpv.gsm +$ cd .. +$ cd .. +$ cd lnztfr +$ ls +137978 bpq +180941 fvpfmwn +148685 hsg.qgj +865 mrqgpv.gsm +$ cd .. +$ cd vwhf +$ ls +dir bgtgqzz +dir fcwzw +dir lcgv +dir mrlvtb +116134 mrqgpv.gsm +dir wszvqd +$ cd bgtgqzz +$ ls +dir dzpjg +283411 nmbfwc +dir smhhzq +240602 ttlbcssq +$ cd dzpjg +$ ls +75545 cmfw.gsj +189219 lcgv.chq +255580 lqndrsh.szf +175733 mrqgpv.gsm +$ cd .. +$ cd smhhzq +$ ls +137259 thjwcz.qhn +$ cd .. +$ cd .. +$ cd fcwzw +$ ls +59717 tpljg +$ cd .. +$ cd lcgv +$ ls +148881 mrzcdzd.gjt +68671 pzqgf.cjd +242866 slpftp +89945 vpsgcl.gfh +196497 wdzw.drg +$ cd .. +$ cd mrlvtb +$ ls +40003 rfzrwc.zjn +$ cd .. +$ cd wszvqd +$ ls +dir bhhtbv +dir lcpvwdq +$ cd bhhtbv +$ ls +dir fbh +248604 ldscpjmp +dir nmbfwc +$ cd fbh +$ ls +256295 vpsgcl.gfh +$ cd .. +$ cd nmbfwc +$ ls +83799 lcgv.vfc +$ cd .. +$ cd .. +$ cd lcpvwdq +$ ls +dir lwhq +212569 rfzrwc.clp +23957 wdzw.drg +$ cd lwhq +$ ls +240867 fzrwpl.hqd +68771 mzsqgswh +88777 pqtqv.qwz +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd znmzg +$ ls +30277 gltpwzg.gjd +211983 wdzw.drg +$ cd .. +$ cd .. +$ cd ldqc +$ ls +dir dnzfqzwv +dir dvshtm +97119 gdnlwmbf +dir gqb +dir jclb +dir jgbsw +115989 lcgv.hlf +255836 lchqqdh.wrn +dir qtdlb +dir rmljszcj +dir tqwpmw +dir vhdgcsw +$ cd dnzfqzwv +$ ls +dir tqv +$ cd tqv +$ ls +139984 dwhz.nhz +240411 pzqgf.cjd +129386 rnnr +190691 svgwt.mql +$ cd .. +$ cd .. +$ cd dvshtm +$ ls +dir lcgv +96767 mrqgpv.gsm +dir qdmmpq +$ cd lcgv +$ ls +82949 bldf.hwn +$ cd .. +$ cd qdmmpq +$ ls +dir lzgwflt +dir vgrdpbg +$ cd lzgwflt +$ ls +148651 tndbwbh +$ cd .. +$ cd vgrdpbg +$ ls +dir wqdlv +$ cd wqdlv +$ ls +130393 rqjc.dnr +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd gqb +$ ls +dir jtf +dir lvwpqs +212592 mrzcdzd.gjt +70051 tqpwdwm.nzz +dir vznbng +52226 wbsdrsfh.tfw +$ cd jtf +$ ls +232635 lvpccb.dmm +105086 wdzw.drg +$ cd .. +$ cd lvwpqs +$ ls +124821 dmhqlt +265915 mrqgpv.gsm +45481 pzqgf.cjd +$ cd .. +$ cd vznbng +$ ls +42179 nrzcpgvl.jft +17752 tld.ghn +174859 zvqglbw.ppl +$ cd .. +$ cd .. +$ cd jclb +$ ls +dir bnz +dir dtmtvbw +dir hnlrtpbz +dir pbb +dir vhjwtq +dir vpfggv +dir zmflq +$ cd bnz +$ ls +199447 mrzcdzd.gjt +$ cd .. +$ cd dtmtvbw +$ ls +dir bjthn +dir hzlhz +dir zmflq +$ cd bjthn +$ ls +272777 pgqfn.tdd +$ cd .. +$ cd hzlhz +$ ls +50958 lcgv.gvq +$ cd .. +$ cd zmflq +$ ls +207442 rrnwns.zpf +15759 wdzw.drg +$ cd .. +$ cd .. +$ cd hnlrtpbz +$ ls +69788 jhqjs.sdj +219666 jljzp.mhf +137518 jqnfg +108183 shfjz.vnr +130164 vpsgcl.gfh +$ cd .. +$ cd pbb +$ ls +dir wqdlv +dir zmflq +$ cd wqdlv +$ ls +dir fgggwt +dir hrghbhj +dir nmbfwc +dir tgmqnq +146479 vpsgcl.gfh +dir wqdlv +$ cd fgggwt +$ ls +264892 wqdlv.zsp +$ cd .. +$ cd hrghbhj +$ ls +116698 bfwtbg +dir lcgv +92758 pzqgf.cjd +dir tsdjgt +284427 vpsgcl.gfh +229621 wqdlv.pml +dir zfjjncvd +$ cd lcgv +$ ls +30459 mrzcdzd.gjt +dir wqdlv +$ cd wqdlv +$ ls +78475 wdzw.drg +$ cd .. +$ cd .. +$ cd tsdjgt +$ ls +166330 jpfms +16410 tjswm.bqv +$ cd .. +$ cd zfjjncvd +$ ls +59841 mrqgpv.gsm +$ cd .. +$ cd .. +$ cd nmbfwc +$ ls +dir jtn +151403 mmjm +240129 mmsb +206021 nmbfwc.sds +84439 vpsgcl.gfh +dir wqdlv +dir zvnrwfhn +$ cd jtn +$ ls +23555 hmmt.gbb +$ cd .. +$ cd wqdlv +$ ls +69742 jppj.vvg +$ cd .. +$ cd zvnrwfhn +$ ls +242009 lcgv.bds +$ cd .. +$ cd .. +$ cd tgmqnq +$ ls +259985 bzqjt +46410 flsm.szr +dir lcgv +89561 npfmc.vqs +17503 vpsgcl.gfh +73719 wqdlv.gjn +$ cd lcgv +$ ls +dir dzfglmz +177553 ffvzsgz +dir ljt +216443 mrzcdzd.gjt +255381 nmbfwc +dir rplqnt +84061 zmflq.vlw +$ cd dzfglmz +$ ls +220883 dqbcfgfd +$ cd .. +$ cd ljt +$ ls +11842 rfzrwc.hpn +$ cd .. +$ cd rplqnt +$ ls +119893 lszmvzst.zng +$ cd .. +$ cd .. +$ cd .. +$ cd wqdlv +$ ls +dir chnpddzn +272999 hbhwqt.fsl +144546 jvhjnsz +dir ppsm +102615 pzqgf.cjd +dir swdnss +$ cd chnpddzn +$ ls +256977 pzqgf.cjd +dir wqdlv +$ cd wqdlv +$ ls +6565 hlcqgmj +$ cd .. +$ cd .. +$ cd ppsm +$ ls +238358 fvw.bzw +dir ggjnl +265010 mrzcdzd.gjt +201818 rfzrwc +dir ssggblm +$ cd ggjnl +$ ls +45841 nlnrrqf.fwn +$ cd .. +$ cd ssggblm +$ ls +276584 djqb.ngq +18926 lcgv +$ cd .. +$ cd .. +$ cd swdnss +$ ls +dir bmrzhjs +$ cd bmrzhjs +$ ls +269825 mrqgpv.gsm +3162 rdmbdwq.bmv +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd zmflq +$ ls +dir hnrnldw +dir lcgv +dir mpmcghz +dir nbbv +dir qsnfzp +dir tntnjg +dir wqdlv +$ cd hnrnldw +$ ls +102631 wjbbjwtm.vvz +$ cd .. +$ cd lcgv +$ ls +dir dzz +dir hbzzf +dir jncrbhc +205204 lqnrp +dir mzzpfnr +dir nmbfwc +dir rfzrwc +dir rnrmhfz +dir zmflq +$ cd dzz +$ ls +dir cvvdv +226221 nggtqdzn +94641 npmpjnjm.bzg +dir rsdw +dir sjrb +41983 vfdz.ngz +271561 zmflq.zsc +$ cd cvvdv +$ ls +64260 hhqv.tsg +31245 pzqgf.cjd +280268 znjjp +$ cd .. +$ cd rsdw +$ ls +dir lcgv +$ cd lcgv +$ ls +37080 nmbfwc +$ cd .. +$ cd .. +$ cd sjrb +$ ls +233530 mrqgpv.gsm +$ cd .. +$ cd .. +$ cd hbzzf +$ ls +36018 mrqgpv.gsm +$ cd .. +$ cd jncrbhc +$ ls +205345 mrqgpv.gsm +244683 nqpcpt +$ cd .. +$ cd mzzpfnr +$ ls +dir hmjzlr +dir lcgv +dir mczs +dir wqdlv +90391 wqdlv.pdr +144119 zmflq +$ cd hmjzlr +$ ls +268342 svsd.jcd +$ cd .. +$ cd lcgv +$ ls +dir pwhl +dir rfzrwc +$ cd pwhl +$ ls +42795 gvmt +82576 wdzw.drg +$ cd .. +$ cd rfzrwc +$ ls +dir jjl +dir mqp +156985 mrqgpv.gsm +dir wptr +dir wqdlv +$ cd jjl +$ ls +dir jrjjr +104785 nmbfwc +20108 wdzw.drg +$ cd jrjjr +$ ls +243753 hgndlcrv.wbc +$ cd .. +$ cd .. +$ cd mqp +$ ls +142621 cljnbs +$ cd .. +$ cd wptr +$ ls +46279 vjqlvhrh.njr +$ cd .. +$ cd wqdlv +$ ls +104474 vpsgcl.gfh +$ cd .. +$ cd .. +$ cd .. +$ cd mczs +$ ls +186843 mrqgpv.gsm +dir pjm +dir thbwb +$ cd pjm +$ ls +dir wqdlv +$ cd wqdlv +$ ls +201647 sgtt +$ cd .. +$ cd .. +$ cd thbwb +$ ls +146494 mrqgpv.gsm +$ cd .. +$ cd .. +$ cd wqdlv +$ ls +103876 mrqgpv.gsm +$ cd .. +$ cd .. +$ cd nmbfwc +$ ls +dir fgctdds +dir rwgscjbv +$ cd fgctdds +$ ls +205015 bwvshdcz.dpp +$ cd .. +$ cd rwgscjbv +$ ls +242899 rbmtfdhp +$ cd .. +$ cd .. +$ cd rfzrwc +$ ls +dir bnsgzwhn +228624 ffj +dir lcgv +dir rcvwcbfd +268775 vbhsh.nnz +129373 vpsgcl.gfh +68919 wqdlv +dir wqmdw +dir zmflq +153277 zmflq.frv +$ cd bnsgzwhn +$ ls +9892 ltcrrzhb.njc +dir wpwmflr +dir zmflq +$ cd wpwmflr +$ ls +274142 bfj.fbw +dir rfzrwc +dir srnm +$ cd rfzrwc +$ ls +161517 mrqgpv.gsm +dir zbhgwsd +$ cd zbhgwsd +$ ls +43750 vbqmpbcr.zwz +$ cd .. +$ cd .. +$ cd srnm +$ ls +dir rvvtgr +$ cd rvvtgr +$ ls +164604 wzgbzbn +$ cd .. +$ cd .. +$ cd .. +$ cd zmflq +$ ls +184482 mrqgpv.gsm +80280 pzqgf.cjd +183303 zln.tbm +$ cd .. +$ cd .. +$ cd lcgv +$ ls +dir lcgv +dir pqttlp +$ cd lcgv +$ ls +dir bpjzg +$ cd bpjzg +$ ls +99853 wdzw.drg +$ cd .. +$ cd .. +$ cd pqttlp +$ ls +dir bgvhcgfn +45115 mrzcdzd.gjt +248058 qnvhgpw.ddw +112129 rfzrwc +$ cd bgvhcgfn +$ ls +228291 nmbfwc.gqj +$ cd .. +$ cd .. +$ cd .. +$ cd rcvwcbfd +$ ls +dir vtrtt +dir wgp +$ cd vtrtt +$ ls +138009 pzqgf.cjd +dir ztsvzpn +$ cd ztsvzpn +$ ls +51632 vpsgcl.gfh +$ cd .. +$ cd .. +$ cd wgp +$ ls +81030 lcgv.zhv +$ cd .. +$ cd .. +$ cd wqmdw +$ ls +dir zmrdf +$ cd zmrdf +$ ls +dir qqgw +$ cd qqgw +$ ls +58554 gqpqvplc.zvr +$ cd .. +$ cd .. +$ cd .. +$ cd zmflq +$ ls +224544 mrzcdzd.gjt +254976 pzqgf.cjd +$ cd .. +$ cd .. +$ cd rnrmhfz +$ ls +19759 lcgv.stz +$ cd .. +$ cd zmflq +$ ls +22390 nftzlqg.qmp +80148 wqdlv +$ cd .. +$ cd .. +$ cd mpmcghz +$ ls +169324 mrqgpv.gsm +65924 wdzw.drg +$ cd .. +$ cd nbbv +$ ls +115297 bqcrc.prw +58148 pvzv.qwf +dir wqdlv +$ cd wqdlv +$ ls +145268 mrzcdzd.gjt +35745 nmbfwc.hgv +112142 wqdlv +$ cd .. +$ cd .. +$ cd qsnfzp +$ ls +241308 nmbfwc.hmg +$ cd .. +$ cd tntnjg +$ ls +19543 mrqgpv.gsm +667 wqdlv +$ cd .. +$ cd wqdlv +$ ls +dir dqpgtmdl +dir jrqsqrv +189727 mrzcdzd.gjt +dir rfzrwc +208280 vpsgcl.gfh +281557 vwsljgn.mwd +119829 zmflq.hgd +$ cd dqpgtmdl +$ ls +268413 qcw.slb +$ cd .. +$ cd jrqsqrv +$ ls +238387 mvllmjc.wvm +213020 nqp.gdr +157257 nzdmplg.zqh +dir ppwcgc +24914 pzqgf.cjd +dir zjr +dir zmflq +$ cd ppwcgc +$ ls +249714 bsrnnhrr.spq +dir cvnd +$ cd cvnd +$ ls +248610 pzqgf.cjd +$ cd .. +$ cd .. +$ cd zjr +$ ls +224145 smwb.mmz +$ cd .. +$ cd zmflq +$ ls +250519 ftggp +147304 vpsgcl.gfh +238706 wdzw.drg +258323 wqdlv.bjp +dir wqgngf +$ cd wqgngf +$ ls +14302 bdz.jdw +dir jpgfsgd +dir ldwgr +22718 nwfh.nzf +$ cd jpgfsgd +$ ls +dir lcgv +dir qbrwz +$ cd lcgv +$ ls +284229 qhwc.zpq +dir wsjs +$ cd wsjs +$ ls +111635 lcgv +$ cd .. +$ cd .. +$ cd qbrwz +$ ls +199057 gpssftw.wdb +$ cd .. +$ cd .. +$ cd ldwgr +$ ls +260404 gdnpg.vjb +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd rfzrwc +$ ls +dir lmcg +$ cd lmcg +$ ls +32819 sjjztgr.rfj +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd vhjwtq +$ ls +dir qgqbrv +$ cd qgqbrv +$ ls +176900 gwbnqtn.rnj +$ cd .. +$ cd .. +$ cd vpfggv +$ ls +144809 cmc.srv +117565 nhddq.bqn +dir scw +dir tpmnhdc +dir vvp +71774 wqdlv.gdm +61647 zmflq +174026 zmflq.wzn +$ cd scw +$ ls +2295 bqbsrj.gnc +243386 mfmdqhh.mzl +$ cd .. +$ cd tpmnhdc +$ ls +dir fjwr +dir lcllz +dir nmbfwc +$ cd fjwr +$ ls +133256 pwgtqz.dpm +159987 vpsgcl.gfh +$ cd .. +$ cd lcllz +$ ls +dir flwws +210654 qmbfw.bsv +dir zmflq +$ cd flwws +$ ls +222222 nmbfwc.vhj +$ cd .. +$ cd zmflq +$ ls +235011 jlzfbt.wlb +49525 rfzrwc.fnc +$ cd .. +$ cd .. +$ cd nmbfwc +$ ls +133730 dqdqhvm +dir lcgv +188291 nmbfwc.qhv +110039 wdzw.drg +249996 wqdlv +dir zmflq +dir zppcvq +$ cd lcgv +$ ls +dir wths +$ cd wths +$ ls +120313 jdbtlf.rrn +$ cd .. +$ cd .. +$ cd zmflq +$ ls +124906 dqdcpzh +$ cd .. +$ cd zppcvq +$ ls +112537 mrzcdzd.gjt +$ cd .. +$ cd .. +$ cd .. +$ cd vvp +$ ls +dir fsw +194927 hvlm.pbd +dir nmbfwc +230376 pgsq +$ cd fsw +$ ls +111889 nmbfwc.smt +dir rfzrwc +$ cd rfzrwc +$ ls +282718 gbvss +$ cd .. +$ cd .. +$ cd nmbfwc +$ ls +dir fvh +160971 ngqvztv.hfg +dir rfzrwc +$ cd fvh +$ ls +256956 mrqgpv.gsm +14363 vbvsncs.jjw +172959 wdzw.drg +$ cd .. +$ cd rfzrwc +$ ls +257264 vpsgcl.gfh +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd zmflq +$ ls +10486 lbdtpnps.jhq +118145 rlgjvn.nvf +176390 wdzw.drg +$ cd .. +$ cd .. +$ cd jgbsw +$ ls +dir cfdljgh +214846 dwqdqv.ftq +dir rfzrwc +147094 vpsgcl.gfh +$ cd cfdljgh +$ ls +261471 mrqgpv.gsm +$ cd .. +$ cd rfzrwc +$ ls +dir fcvfw +dir gvqrwgrs +57417 zfqrqv.fvp +$ cd fcvfw +$ ls +279614 wdzw.drg +$ cd .. +$ cd gvqrwgrs +$ ls +dir sgfltf +$ cd sgfltf +$ ls +204207 mstlc.wtj +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd qtdlb +$ ls +dir gjpmcvwp +dir nsjlcmfz +dir wqdlv +$ cd gjpmcvwp +$ ls +dir cjjdzcwm +$ cd cjjdzcwm +$ ls +233873 pdnsrz.vfp +$ cd .. +$ cd .. +$ cd nsjlcmfz +$ ls +53472 nmbfwc +dir qvpj +$ cd qvpj +$ ls +150929 mrzcdzd.gjt +$ cd .. +$ cd .. +$ cd wqdlv +$ ls +dir qccsnjd +$ cd qccsnjd +$ ls +65908 hsrqhn.hjr +267802 zmflq.jdt +$ cd .. +$ cd .. +$ cd .. +$ cd rmljszcj +$ ls +dir jnstrbj +172566 nbtszsgl +dir wqdlv +$ cd jnstrbj +$ ls +232158 fgccmchh.wqg +236339 mrqgpv.gsm +281875 rfzrwc.sfd +$ cd .. +$ cd wqdlv +$ ls +58492 wdzw.drg +213853 wqdlv.zlz +$ cd .. +$ cd .. +$ cd tqwpmw +$ ls +92747 pzqgf.cjd +$ cd .. +$ cd vhdgcsw +$ ls +125104 crfw.sfv +dir flhbhzlt +139949 mrqgpv.gsm +dir rfzrwc +dir rnz +97174 zmflq.vpn +$ cd flhbhzlt +$ ls +282258 mrzcdzd.gjt +$ cd .. +$ cd rfzrwc +$ ls +dir lcgv +$ cd lcgv +$ ls +dir dlpng +dir glqrj +178245 lcgv +106863 nmbfwc.fgr +$ cd dlpng +$ ls +195950 rfzrwc +$ cd .. +$ cd glqrj +$ ls +248909 pzqgf.cjd +34214 vpsgcl.gfh +$ cd .. +$ cd .. +$ cd .. +$ cd rnz +$ ls +dir chfccv +dir cmsccq +dir zmflq +$ cd chfccv +$ ls +13688 mrqgpv.gsm +162142 vpsgcl.gfh +$ cd .. +$ cd cmsccq +$ ls +94122 dzpsltth +190025 rfzrwc +dir twqt +12230 wgghbcz.tph +60111 wqdlv +$ cd twqt +$ ls +109250 wdzw.drg +$ cd .. +$ cd .. +$ cd zmflq +$ ls +174075 wdzw.drg +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd vrvl +$ ls +dir pnfv +210089 rfzrwc +dir stcfmz +$ cd pnfv +$ ls +183315 rhmztnnh +$ cd .. +$ cd stcfmz +$ ls +115637 lcgv \ No newline at end of file diff --git a/days6-10/day8/__pycache__/load_map.cpython-311.pyc b/2022/day8/__pycache__/load_map.cpython-311.pyc similarity index 100% rename from days6-10/day8/__pycache__/load_map.cpython-311.pyc rename to 2022/day8/__pycache__/load_map.cpython-311.pyc diff --git a/days6-10/day8/day8_part1.py b/2022/day8/day8_part1.py similarity index 100% rename from days6-10/day8/day8_part1.py rename to 2022/day8/day8_part1.py diff --git a/days6-10/day8/day8_part2.py b/2022/day8/day8_part2.py similarity index 100% rename from days6-10/day8/day8_part2.py rename to 2022/day8/day8_part2.py diff --git a/days6-10/day8/input.txt b/2022/day8/input.txt similarity index 100% rename from days6-10/day8/input.txt rename to 2022/day8/input.txt diff --git a/days6-10/day8/load_map.py b/2022/day8/load_map.py similarity index 100% rename from days6-10/day8/load_map.py rename to 2022/day8/load_map.py diff --git a/2022/day9/day9_part1.py b/2022/day9/day9_part1.py new file mode 100644 index 0000000..cd7c2ea --- /dev/null +++ b/2022/day9/day9_part1.py @@ -0,0 +1,99 @@ +def main(): + with open('input.txt', 'r') as f: + head_moves = f.readlines() + head_moves = [move.split() for move in head_moves] + + head_pos, tail_pos = [0,0], [0,0] + pos_list = [] + for move in head_moves: + pos_list.append(tuple(tail_pos)) + if move[0] == 'U': + for i in range(int(move[1])): + head_pos[1] += 1 + if validate_pos(head_pos, tail_pos): + pos_list.append(tuple(tail_pos)) + continue + if head_pos[0] == tail_pos[0]: + tail_pos[1] += 1 + pos_list.append(tuple(tail_pos)) + elif head_pos[0] == tail_pos[0] + 1: + tail_pos[1] += 1 + pos_list.append(tuple(tail_pos)) + tail_pos[0] += 1 + pos_list.append(tuple(tail_pos)) + elif head_pos[0] == tail_pos[0] - 1: + tail_pos[1] += 1 + pos_list.append(tuple(tail_pos)) + tail_pos[0] -= 1 + pos_list.append(tuple(tail_pos)) + elif move[0] == 'D': + for i in range(int(move[1])): + head_pos[1] -= 1 + if validate_pos(head_pos, tail_pos): + pos_list.append(tuple(tail_pos)) + continue + if head_pos[0] == tail_pos[0]: + tail_pos[1] -= 1 + pos_list.append(tuple(tail_pos)) + elif head_pos[0] == tail_pos[0] + 1: + tail_pos[1] -= 1 + pos_list.append(tuple(tail_pos)) + tail_pos[0] += 1 + pos_list.append(tuple(tail_pos)) + elif head_pos[0] == tail_pos[0] - 1: + tail_pos[1] -= 1 + pos_list.append(tuple(tail_pos)) + tail_pos[0] -= 1 + pos_list.append(tuple(tail_pos)) + elif move[0] == 'R': + for i in range(int(move[1])): + head_pos[0] += 1 + if validate_pos(head_pos, tail_pos): + pos_list.append(tuple(tail_pos)) + continue + if head_pos[1] == tail_pos[1]: + tail_pos[0] += 1 + pos_list.append(tuple(tail_pos)) + elif head_pos[1] == tail_pos[1] + 1: + tail_pos[0] += 1 + pos_list.append(tuple(tail_pos)) + tail_pos[1] += 1 + pos_list.append(tuple(tail_pos)) + elif head_pos[1] == tail_pos[1] - 1: + tail_pos[0] += 1 + pos_list.append(tuple(tail_pos)) + tail_pos[1] -= 1 + pos_list.append(tuple(tail_pos)) + elif move[0] == 'L': + for i in range(int(move[1])): + head_pos[0] -= 1 + if validate_pos(head_pos, tail_pos): + pos_list.append(tuple(tail_pos)) + continue + if head_pos[1] == tail_pos[1]: + tail_pos[0] -= 1 + pos_list.append(tuple(tail_pos)) + elif head_pos[1] == tail_pos[1] + 1: + tail_pos[0] -= 1 + pos_list.append(tuple(tail_pos)) + tail_pos[1] += 1 + pos_list.append(tuple(tail_pos)) + elif head_pos[1] == tail_pos[1] - 1: + tail_pos[0] -= 1 + pos_list.append(tuple(tail_pos)) + tail_pos[1] -= 1 + pos_list.append(tuple(tail_pos)) + + pos_set = set(pos_list) + pos_list = list(pos_set) + print(len(pos_list)) + + #print(f"Repeated positions: {pos_count}") + + +def validate_pos(h: list[int], t: list[int]) -> bool: + return -2 < h[0] - t[0] < 2 and -2 < h[1] - t[1] < 2 + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/2022/day9/input.txt b/2022/day9/input.txt new file mode 100644 index 0000000..d41a63d --- /dev/null +++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D 12 +U 11 +L 6 +U 15 +L 12 +R 1 +D 6 +L 16 +R 1 +D 7 +R 17 +L 15 +D 15 +U 9 +R 18 +D 13 +R 14 +D 1 +R 1 +D 16 +L 18 +R 1 +U 14 +L 8 +D 14 +R 15 +D 2 +U 10 +D 17 +U 3 +D 9 +R 7 +D 17 +U 3 +D 15 +L 17 +D 17 +R 1 +D 10 +L 9 +D 14 +R 5 +U 14 +R 14 +D 12 +R 18 +U 4 +D 2 +U 17 +D 12 +L 4 +U 9 +L 9 +U 17 +R 4 +U 17 +R 8 +D 10 +R 3 +D 9 +U 17 +L 5 +R 16 +U 9 +L 5 +D 15 +U 2 +D 7 +L 15 +U 1 +L 16 +R 8 +L 13 +R 3 +D 8 +R 1 +D 8 +L 10 +U 16 +R 16 +L 2 +U 3 +D 9 +U 12 +D 1 +L 10 +D 15 +U 7 +R 3 +D 15 +U 4 +L 6 +R 14 +U 13 +R 16 +U 2 +R 9 +U 15 +D 8 +L 8 +R 17 +D 3 +L 17 +D 13 +U 8 +D 11 +R 13 +L 3 +D 2 +U 14 +R 1 +U 10 +R 11 +D 16 +L 10 +R 17 +U 7 +L 13 +R 3 +L 18 +R 5 +U 7 +L 12 +D 4 +U 5 +L 17 +R 18 +L 4 +R 19 +L 12 +U 17 +R 2 +L 11 +R 9 +D 16 +R 19 +L 18 +U 11 +D 4 +R 13 +L 18 +U 13 +R 19 +D 3 +R 10 +L 3 +R 5 +D 2 +R 2 +L 18 +D 15 +R 19 +L 5 +D 4 +U 5 +R 12 +D 15 +L 13 +R 16 +U 16 +L 6 +U 12 +L 8 \ No newline at end of file diff --git a/README.md b/README.md index 4a57525..9f46676 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,11 @@ -# Advent of Code 2022 -### Solutions for the 2022 AoC challenges +# Advent of Code +## Solutions for the AoC Challenges ### They might not be the best solutions but they work and that's the important part of a coders job :xdd: ---- -## Languages used: -#### Python: -* Day 1 -* Day 2 -* Day 4 -* Day 5 -* Day 6 -* Day 8 -#### C#: -* Day 3 +--- +## Languages used by days: +### 2022 +| Language | Days | +|----------|------------------| +| Python | 1, 2, 4, 5, 6, 8 | +| C# | 3 | \ No newline at end of file diff --git a/day-selector.py b/day-selector.py deleted file mode 100644 index 0340ca5..0000000 --- a/day-selector.py +++ /dev/null @@ -1,29 +0,0 @@ -import os -from datetime import date - - -def main(args): - currentDay = date.today().day - reposDirectory = f"/home/{os.getlogin()}/repos/advent-of-code-2022" - dayGroups = [(int(days[4:].split('-')[0]), int(days[4:].split('-')[1])) for days in [directory for directory in os.listdir(reposDirectory) if directory.startswith('days')][::-1]] - indexOfDayGroup = -1 - for dayGroup in dayGroups: - if dayGroup[0] < currentDay < dayGroup[1]: - indexOfDayGroup = dayGroups.index(dayGroup) - break - currentDayGroupDir = f"{reposDirectory}/days{dayGroups[indexOfDayGroup][0]}-{dayGroups[indexOfDayGroup][1]}" - currentDayDir = f"{currentDayGroupDir}/day{currentDay}" - - if len(args) > 1: - if args[1] == "run": - os.system(f"python3 {currentDayDir}/day{currentDay}.py") - return - - if f"day{currentDay}" not in os.listdir(currentDayGroupDir): - os.system(f"mkdir {currentDayDir}") - os.system(f"vim {currentDayDir}/day{currentDay}.py") - - -import sys -if __name__ == "__main__": - main(sys.argv)