Started the migration to the C# solution

This commit is contained in:
Tiago Garcia 2023-06-07 22:43:31 +01:00
parent 8596c316cf
commit 6b22e08e99
No known key found for this signature in database
GPG Key ID: F423E37A2415E160
60 changed files with 0 additions and 10570 deletions

View File

@ -1,25 +0,0 @@
def main():
with open('input.txt', 'r') as f:
# Part 1
calories = [line for line in f.read().split('\n')]
caloriesPerDay = [0] * len(calories)
index = 0
for calorie in calories:
if calorie == '':
index += 1
else:
caloriesPerDay[index] += int(calorie)
nOfElfs = caloriesPerDay.index(0)
caloriesPerElf = caloriesPerDay[:nOfElfs]
print(f"Top elf calorie count: {max(caloriesPerElf)}")
# Part 2
sumOfCaloriesOfTopThree = []
for i in range(3):
sumOfCaloriesOfTopThree.append(max(caloriesPerElf))
caloriesPerElf.remove(max(caloriesPerElf))
print(f"Sum of top three elfs: {sum(sumOfCaloriesOfTopThree)}")
if __name__ == '__main__':
main()

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
with open('input.txt', 'r') as f:
# Part 1
matches = [rpsMatch.split(' ') for rpsMatch in f.read().split('\n')]
score = 0
for rpsMatch in matches:
if rpsMatch[0] == 'A':
if rpsMatch[1] == 'X':
score += 1 + 3
elif rpsMatch[1] == 'Y':
score += 2 + 6
elif rpsMatch[1] == 'Z':
score += 3
elif rpsMatch[0] == 'B':
if rpsMatch[1] == 'X':
score += 1
elif rpsMatch[1] == 'Y':
score += 2 + 3
elif rpsMatch[1] == 'Z':
score += 3 + 6
elif rpsMatch[0] == 'C':
if rpsMatch[1] == 'X':
score += 1 + 6
elif rpsMatch[1] == 'Y':
score += 2
elif rpsMatch[1] == 'Z':
score += 3 + 3
print(f"Total score: {score}")

View File

@ -1,27 +0,0 @@
with open('input.txt', 'r') as f:
# Part 2
matches = [rpsMatch.split(' ') for rpsMatch in f.read().split('\n')]
score = 0
for rpsMatch in matches:
if rpsMatch[0] == 'A':
if rpsMatch[1] == 'X':
score += 3
elif rpsMatch[1] == 'Y':
score += 1 + 3
elif rpsMatch[1] == 'Z':
score += 2 + 6
elif rpsMatch[0] == 'B':
if rpsMatch[1] == 'X':
score += 1
elif rpsMatch[1] == 'Y':
score += 2 + 3
elif rpsMatch[1] == 'Z':
score += 3 + 6
elif rpsMatch[0] == 'C':
if rpsMatch[1] == 'X':
score += 2
elif rpsMatch[1] == 'Y':
score += 3 + 3
elif rpsMatch[1] == 'Z':
score += 1 + 6
print(f"Total score: {score}")

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/projectSettingsUpdater.xml
/contentModel.xml
/.idea.Day3.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1 +0,0 @@
Day3

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

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

View File

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -1,16 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day3", "Day3.csproj", "{097D408C-BA93-416B-8F2C-3B61A729F20D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{097D408C-BA93-416B-8F2C-3B61A729F20D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{097D408C-BA93-416B-8F2C-3B61A729F20D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{097D408C-BA93-416B-8F2C-3B61A729F20D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{097D408C-BA93-416B-8F2C-3B61A729F20D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -1,38 +0,0 @@
namespace Day3;
public class Part1
{
private static int _sum = 0;
public static void Part1Solver()
{
string[] backpacks = File.ReadAllText("input.txt").Split('\n');
List<char> duplicates = new List<char>();
foreach (string backpack in backpacks)
{
int compartmentSize = backpack.Length / 2;
List<char> itemsInCompartment1 = new List<char>();
List<char> itemsInCompartment2 = new List<char>();
for (int i = 0; i < compartmentSize; i++)
itemsInCompartment1.Add(backpack[i]);
for (int i = compartmentSize; i < compartmentSize * 2; i++)
itemsInCompartment2.Add(backpack[i]);
char duplicatedItem = itemsInCompartment1.Intersect(itemsInCompartment2).FirstOrDefault();
duplicates.Add(duplicatedItem);
}
duplicates.RemoveAt(300);
foreach (char duplicate in duplicates)
{
if (Char.IsUpper(duplicate))
_sum += Convert.ToInt16(duplicate) - 38;
else
_sum += Convert.ToInt16(duplicate) - 96;
}
Console.WriteLine($"Sum is {_sum}");
}
}

View File

@ -1,48 +0,0 @@
namespace Day3;
public class Part2
{
private static int _sum = 0;
public static void Part2Solver()
{
string[] backpacks = File.ReadAllText("input.txt").Split('\n');
List<List<string>> groups = new List<List<string>>();
for (int i = 0; i < backpacks.Length; i+=3)
{
List<string> group = new List<string>();
for (int x = 0; x < 3; x++)
{
try
{
group.Add(backpacks[i + x]);
}
catch
{
break;
}
}
if (group.All(x => x != ""))
groups.Add(group);
}
List<char> duplicates = new List<char>();
foreach (List<string> group in groups)
{
string[] groupArray = group.ToArray();
duplicates.Add(groupArray[0].Intersect(groupArray[1].Intersect(groupArray[2])).FirstOrDefault());
}
foreach (char duplicate in duplicates)
{
if (Char.IsUpper(duplicate))
_sum += Convert.ToInt16(duplicate) - 38;
else
_sum += Convert.ToInt16(duplicate) - 96;
}
Console.WriteLine($"Sum is {_sum}");
}
}

View File

@ -1,8 +0,0 @@
namespace Day3;
internal class Program
{
public static void Main(string[] args)
=> Part2.Part2Solver();
}

Binary file not shown.

View File

@ -1,23 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"Day3/1.0.0": {
"runtime": {
"Day3.dll": {}
}
}
}
},
"libraries": {
"Day3/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +0,0 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
}
}
}

View File

@ -1,300 +0,0 @@
dtddvvhwttHJhwdhJPddhwJGppmGjgpQgTjQplQpTljwpg
BfzSzRSVVMVNRMDDNBSNSnfBmbrglGQbmNpQggFjpgpbQlQb
ZSBffLnVZdCCPJjhhL
RGCZpWWWFlHQQbgvFssg
jLnMzjnrnjjNjhrjdwbHscsVVgDVQPvPwh
nfJnLMLzjJMtnjNnnBbZtBWBqqbTTTBRpT
nddlhBtqTBqTVSlBtmCmVcRVmZggfWbcZc
jDjvPrPSNPwrDNRWbbgWCjRRCcWm
DzDwSpFrvrvFPQLzQnsqztBthTJnGJqlsJ
gssGmzwgRgsNmTsqgDnDJnbDHHhhzFdDDh
WQVFjMWrVQrVvVVjVctSSLSMZhnJZPBnbdnhbnHZZBDJBh
VCtcccVQLrfvrSlGmfTfNgfmlFgm
DsmfsBbNNZhDWsbmWmNbbPDHLFjcctjjGcnZGzncnctcGH
SwVQJrjVwpgSVRpjpVRrlTMCFFCLCFFcHzzGMc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/Day3.csproj": {}
},
"projects": {
"/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3.csproj",
"projectName": "Day3",
"projectPath": "/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3.csproj",
"packagesPath": "/home/tiagorg/.nuget/packages/",
"outputPath": "/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/tiagorg/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/6.0.111/RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/tiagorg/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/tiagorg/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/tiagorg/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -1,4 +0,0 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]

View File

@ -1,22 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Day3")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Day3")]
[assembly: System.Reflection.AssemblyTitleAttribute("Day3")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -1 +0,0 @@
0dac98bec9329467876de2744db541b9695c4a5a

View File

@ -1,10 +0,0 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Day3
build_property.ProjectDir = /home/tiagorg/repos/advent-of-code-2022/days1-5/day3/

View File

@ -1,8 +0,0 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -1 +0,0 @@
c934cb40fbc3b9f9ef1ef028f4547779ca0dc8b7

View File

@ -1,15 +0,0 @@
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/bin/Debug/net6.0/Day3
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/bin/Debug/net6.0/Day3.deps.json
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/bin/Debug/net6.0/Day3.runtimeconfig.json
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/bin/Debug/net6.0/Day3.dll
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/bin/Debug/net6.0/ref/Day3.dll
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/bin/Debug/net6.0/Day3.pdb
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/Day3.csproj.AssemblyReference.cache
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/Day3.GeneratedMSBuildEditorConfig.editorconfig
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/Day3.AssemblyInfoInputs.cache
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/Day3.AssemblyInfo.cs
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/Day3.csproj.CoreCompileInputs.cache
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/Day3.dll
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/ref/Day3.dll
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/Day3.pdb
/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3/obj/Debug/net6.0/Day3.genruntimeconfig.cache

Binary file not shown.

View File

@ -1 +0,0 @@
b0fc49afd48396266b0092be0971ac33419bc314

Binary file not shown.

Binary file not shown.

View File

@ -1,65 +0,0 @@
{
"version": 3,
"targets": {
"net6.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net6.0": []
},
"packageFolders": {
"/home/tiagorg/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3.csproj",
"projectName": "Day3",
"projectPath": "/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3.csproj",
"packagesPath": "/home/tiagorg/.nuget/packages/",
"outputPath": "/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/tiagorg/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/6.0.111/RuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -1,8 +0,0 @@
{
"version": 2,
"dgSpecHash": "GxvEt/zas/vqUdpHzZMZPvuL+haK583RnNkxhVCSPdJDli7g7c3qfF2A6o3s8ThqnbQPqZDD01GBDr24H4DZdg==",
"success": true,
"projectFilePath": "/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3.csproj",
"expectedPackageFiles": [],
"logs": []
}

View File

@ -1 +0,0 @@
"restore":{"projectUniqueName":"/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3.csproj","projectName":"Day3","projectPath":"/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/Day3.csproj","outputPath":"/home/tiagorg/repos/advent-of-code-2022/days1-5/day3/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net6.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net6.0":{"targetAlias":"net6.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net6.0":{"targetAlias":"net6.0","imports":["net461","net462","net47","net471","net472","net48"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/lib/dotnet/sdk/6.0.111/RuntimeIdentifierGraph.json"}}

View File

@ -1 +0,0 @@
16702392523558223

View File

@ -1,18 +0,0 @@
with open('input.txt', 'r') as f:
inputContent = f.read().splitlines()
containedCount = 0
intersectCount = 0
for line in inputContent:
pair = line.split(',')
startRange1, endRange1 = pair[0].split('-')
startRange2, endRange2 = pair[1].split('-')
if ((int(startRange1) >= int(startRange2) and int(endRange1) <= int(endRange2))
or (int(startRange2) >= int(startRange1) and int(endRange2) <= int(endRange1))):
containedCount += 1
if ((int(endRange1) >= int(startRange2) and int(startRange1) <= int(endRange2))
or (int(endRange2) >= int(startRange1) and int(startRange2) <= int(endRange1))):
intersectCount += 1
print("Contained Count:", containedCount)
print("Intersect Count:", intersectCount)

File diff suppressed because it is too large Load Diff

View File

@ -1,60 +0,0 @@
def main() -> None:
with open('input.txt', 'r') as f:
input_content = f.read()
crate_input_content, moves_input_content = input_content.split('\n\n')
crates_dictionary = {
1: [],
2: [],
3: [],
4: [],
5: [],
6: [],
7: [],
8: [],
9: [],
}
crates_dictionary_builder(crates_dictionary, crate_input_content)
move_list = move_list_builder(moves_input_content)
print(crates_dictionary)
for move in move_list:
crates_moved = crates_dictionary[move[1]][:move[0]]
for i in range(move[0]):
crates_dictionary[move[1]].remove(crates_dictionary[move[1]][0])
for crate in crates_moved[::-1]: # Remove [::-1] for part 1
crates_dictionary[move[2]].insert(0, crate)
print(crates_dictionary)
for crates in crates_dictionary.values():
print(crates[0], end='')
def crates_dictionary_builder(c_dict: dict, content: str) -> None:
content_lines = content[:-1].splitlines()
for line in content_lines:
first_crate = 0
if line[first_crate] == '[':
c_dict[1].append(line[1])
while '[' in line[first_crate+1:]:
try:
first_crate = line.index('[', first_crate+1)
except ValueError:
print('a')
c_dict[first_crate//4+1] += line[first_crate+1]
def move_list_builder(content: str) -> list[tuple]:
moves_content = content.splitlines()
move_list = []
for move in moves_content:
move = move[5:]
moved, rest = move.split(' from ')
moved_from, moved_to = rest.split(' to ')
move_list.append((int(moved), int(moved_from), int(moved_to)))
return move_list
if __name__ == "__main__":
main()

View File

@ -1,512 +0,0 @@
[V] [C] [M]
[V] [J] [N] [H] [V]
[R] [F] [N] [W] [Z] [N]
[H] [R] [D] [Q] [M] [L] [B]
[B] [C] [H] [V] [R] [C] [G] [R]
[G] [G] [F] [S] [D] [H] [B] [R] [S]
[D] [N] [S] [D] [H] [G] [J] [J] [G]
[W] [J] [L] [J] [S] [P] [F] [S] [L]
1 2 3 4 5 6 7 8 9
move 2 from 2 to 7
move 8 from 5 to 6
move 2 from 4 to 5
move 1 from 4 to 5
move 1 from 5 to 8
move 5 from 9 to 2
move 7 from 1 to 6
move 7 from 3 to 8
move 1 from 4 to 6
move 2 from 5 to 6
move 6 from 7 to 5
move 2 from 2 to 4
move 4 from 5 to 2
move 10 from 8 to 1
move 2 from 7 to 4
move 4 from 2 to 8
move 2 from 9 to 8
move 1 from 8 to 4
move 2 from 4 to 9
move 5 from 8 to 2
move 1 from 4 to 6
move 1 from 8 to 9
move 1 from 7 to 2
move 2 from 4 to 2
move 1 from 7 to 3
move 13 from 2 to 1
move 1 from 2 to 4
move 1 from 2 to 3
move 2 from 5 to 4
move 17 from 6 to 4
move 3 from 4 to 9
move 14 from 1 to 4
move 4 from 6 to 8
move 1 from 9 to 8
move 23 from 4 to 8
move 6 from 1 to 7
move 3 from 1 to 5
move 1 from 3 to 8
move 5 from 7 to 8
move 1 from 3 to 4
move 1 from 5 to 3
move 1 from 5 to 1
move 1 from 3 to 2
move 1 from 9 to 4
move 9 from 4 to 9
move 1 from 1 to 2
move 11 from 8 to 2
move 1 from 4 to 5
move 13 from 2 to 3
move 7 from 9 to 6
move 1 from 5 to 6
move 1 from 5 to 2
move 1 from 9 to 4
move 1 from 4 to 9
move 2 from 8 to 9
move 1 from 7 to 8
move 8 from 9 to 1
move 8 from 1 to 4
move 4 from 6 to 7
move 1 from 9 to 4
move 2 from 3 to 9
move 1 from 9 to 1
move 6 from 4 to 1
move 2 from 1 to 3
move 22 from 8 to 6
move 1 from 2 to 5
move 3 from 7 to 8
move 15 from 6 to 4
move 7 from 3 to 7
move 4 from 6 to 9
move 2 from 9 to 2
move 6 from 3 to 5
move 3 from 9 to 5
move 5 from 5 to 8
move 1 from 2 to 1
move 6 from 8 to 2
move 1 from 1 to 2
move 3 from 5 to 3
move 1 from 7 to 2
move 4 from 7 to 8
move 4 from 6 to 1
move 1 from 5 to 1
move 4 from 8 to 7
move 2 from 3 to 2
move 1 from 1 to 3
move 15 from 4 to 2
move 3 from 7 to 3
move 4 from 7 to 2
move 1 from 4 to 9
move 5 from 3 to 8
move 29 from 2 to 1
move 1 from 9 to 5
move 1 from 2 to 1
move 11 from 1 to 5
move 1 from 4 to 5
move 2 from 6 to 3
move 1 from 3 to 4
move 16 from 1 to 9
move 4 from 8 to 4
move 3 from 6 to 9
move 1 from 3 to 7
move 1 from 7 to 3
move 6 from 1 to 6
move 3 from 4 to 3
move 3 from 8 to 5
move 3 from 1 to 8
move 3 from 1 to 4
move 2 from 4 to 9
move 3 from 6 to 3
move 15 from 5 to 2
move 3 from 2 to 3
move 4 from 2 to 7
move 2 from 5 to 9
move 10 from 3 to 6
move 11 from 9 to 5
move 2 from 4 to 9
move 8 from 9 to 4
move 1 from 9 to 6
move 7 from 4 to 6
move 3 from 5 to 8
move 22 from 6 to 9
move 4 from 7 to 8
move 8 from 5 to 8
move 2 from 4 to 3
move 1 from 8 to 1
move 17 from 8 to 3
move 3 from 3 to 4
move 13 from 3 to 9
move 20 from 9 to 7
move 2 from 2 to 9
move 19 from 9 to 5
move 1 from 1 to 4
move 3 from 2 to 7
move 4 from 4 to 3
move 1 from 9 to 8
move 18 from 5 to 1
move 1 from 9 to 4
move 1 from 9 to 7
move 2 from 4 to 8
move 1 from 5 to 4
move 3 from 2 to 7
move 3 from 3 to 1
move 2 from 1 to 3
move 3 from 3 to 8
move 1 from 4 to 8
move 6 from 8 to 2
move 1 from 3 to 9
move 1 from 3 to 9
move 10 from 1 to 9
move 7 from 1 to 7
move 4 from 7 to 4
move 29 from 7 to 3
move 6 from 2 to 9
move 25 from 3 to 6
move 5 from 3 to 9
move 13 from 6 to 9
move 12 from 6 to 2
move 1 from 8 to 9
move 10 from 2 to 6
move 7 from 6 to 5
move 20 from 9 to 3
move 11 from 3 to 6
move 1 from 7 to 9
move 2 from 2 to 9
move 19 from 9 to 2
move 14 from 6 to 8
move 4 from 5 to 2
move 2 from 4 to 6
move 3 from 5 to 1
move 13 from 8 to 5
move 1 from 6 to 1
move 2 from 4 to 2
move 8 from 2 to 4
move 6 from 4 to 7
move 1 from 9 to 8
move 2 from 4 to 7
move 5 from 2 to 4
move 4 from 4 to 2
move 10 from 5 to 6
move 1 from 1 to 7
move 1 from 5 to 4
move 1 from 4 to 9
move 4 from 7 to 8
move 5 from 1 to 7
move 1 from 9 to 7
move 7 from 3 to 2
move 2 from 5 to 2
move 8 from 6 to 9
move 1 from 4 to 6
move 3 from 7 to 4
move 5 from 9 to 7
move 2 from 4 to 3
move 20 from 2 to 4
move 2 from 4 to 8
move 14 from 4 to 2
move 12 from 7 to 4
move 8 from 2 to 1
move 10 from 2 to 4
move 6 from 8 to 5
move 1 from 7 to 8
move 4 from 4 to 3
move 1 from 3 to 9
move 1 from 2 to 7
move 1 from 6 to 8
move 5 from 3 to 5
move 1 from 3 to 2
move 7 from 4 to 5
move 6 from 1 to 7
move 5 from 7 to 6
move 1 from 6 to 5
move 2 from 7 to 8
move 1 from 2 to 6
move 2 from 8 to 2
move 5 from 5 to 7
move 6 from 6 to 8
move 16 from 4 to 9
move 16 from 9 to 4
move 11 from 5 to 4
move 5 from 8 to 3
move 2 from 5 to 2
move 14 from 4 to 2
move 1 from 6 to 3
move 1 from 6 to 9
move 1 from 5 to 3
move 3 from 8 to 2
move 10 from 4 to 7
move 5 from 9 to 2
move 3 from 4 to 7
move 1 from 1 to 4
move 3 from 2 to 5
move 2 from 3 to 7
move 1 from 4 to 2
move 18 from 2 to 8
move 3 from 8 to 4
move 5 from 3 to 1
move 1 from 3 to 9
move 1 from 9 to 3
move 8 from 8 to 7
move 2 from 5 to 4
move 1 from 5 to 6
move 1 from 2 to 5
move 1 from 5 to 8
move 1 from 6 to 9
move 3 from 2 to 7
move 27 from 7 to 4
move 2 from 2 to 4
move 4 from 8 to 4
move 1 from 9 to 8
move 3 from 1 to 6
move 1 from 3 to 5
move 3 from 8 to 3
move 1 from 1 to 4
move 1 from 8 to 1
move 3 from 1 to 4
move 2 from 8 to 2
move 2 from 6 to 2
move 8 from 4 to 9
move 1 from 7 to 1
move 1 from 5 to 4
move 1 from 7 to 3
move 4 from 2 to 7
move 1 from 8 to 6
move 8 from 9 to 7
move 1 from 6 to 3
move 3 from 3 to 4
move 37 from 4 to 1
move 1 from 4 to 5
move 13 from 7 to 8
move 6 from 8 to 4
move 5 from 8 to 3
move 1 from 7 to 6
move 4 from 1 to 5
move 1 from 6 to 5
move 2 from 8 to 4
move 32 from 1 to 5
move 1 from 1 to 4
move 5 from 3 to 5
move 1 from 3 to 2
move 1 from 2 to 9
move 19 from 5 to 2
move 1 from 9 to 1
move 16 from 5 to 1
move 7 from 5 to 6
move 1 from 3 to 1
move 11 from 1 to 2
move 18 from 2 to 4
move 1 from 5 to 9
move 8 from 6 to 1
move 10 from 2 to 6
move 7 from 4 to 9
move 2 from 2 to 1
move 7 from 4 to 2
move 5 from 4 to 5
move 2 from 9 to 6
move 9 from 6 to 3
move 5 from 5 to 3
move 8 from 4 to 9
move 7 from 9 to 8
move 4 from 2 to 9
move 10 from 3 to 1
move 6 from 8 to 1
move 2 from 6 to 3
move 5 from 3 to 8
move 3 from 2 to 7
move 1 from 9 to 5
move 1 from 3 to 5
move 2 from 7 to 8
move 1 from 8 to 9
move 1 from 6 to 1
move 23 from 1 to 4
move 2 from 5 to 3
move 1 from 8 to 2
move 2 from 8 to 5
move 2 from 5 to 6
move 1 from 2 to 7
move 1 from 7 to 5
move 4 from 9 to 7
move 1 from 7 to 5
move 1 from 3 to 6
move 3 from 7 to 4
move 1 from 3 to 8
move 1 from 4 to 6
move 6 from 1 to 8
move 4 from 6 to 4
move 2 from 9 to 1
move 1 from 5 to 1
move 19 from 4 to 2
move 2 from 9 to 3
move 1 from 9 to 3
move 9 from 1 to 8
move 1 from 5 to 8
move 1 from 9 to 3
move 2 from 3 to 9
move 3 from 8 to 4
move 1 from 4 to 9
move 1 from 9 to 5
move 2 from 3 to 4
move 6 from 4 to 7
move 3 from 9 to 5
move 4 from 4 to 7
move 1 from 5 to 6
move 18 from 2 to 7
move 13 from 7 to 9
move 3 from 5 to 1
move 1 from 2 to 1
move 1 from 6 to 5
move 3 from 1 to 7
move 1 from 1 to 5
move 7 from 9 to 6
move 8 from 7 to 4
move 11 from 7 to 6
move 5 from 9 to 2
move 17 from 6 to 1
move 2 from 5 to 1
move 11 from 8 to 1
move 20 from 1 to 2
move 3 from 8 to 1
move 1 from 9 to 8
move 1 from 6 to 1
move 11 from 1 to 7
move 18 from 2 to 3
move 12 from 4 to 8
move 11 from 7 to 3
move 7 from 2 to 3
move 2 from 1 to 5
move 1 from 1 to 3
move 1 from 8 to 1
move 1 from 5 to 9
move 1 from 9 to 6
move 1 from 8 to 7
move 1 from 5 to 3
move 1 from 6 to 7
move 2 from 8 to 1
move 8 from 3 to 2
move 7 from 2 to 9
move 6 from 8 to 6
move 1 from 9 to 3
move 2 from 6 to 4
move 5 from 9 to 6
move 7 from 6 to 2
move 8 from 2 to 9
move 2 from 1 to 9
move 2 from 7 to 2
move 2 from 4 to 8
move 1 from 2 to 7
move 25 from 3 to 7
move 7 from 9 to 7
move 1 from 2 to 5
move 1 from 1 to 4
move 3 from 8 to 1
move 3 from 1 to 8
move 3 from 7 to 8
move 15 from 7 to 3
move 10 from 8 to 3
move 1 from 5 to 7
move 1 from 8 to 5
move 3 from 9 to 2
move 1 from 6 to 4
move 2 from 2 to 7
move 1 from 2 to 5
move 14 from 7 to 9
move 1 from 6 to 2
move 1 from 7 to 1
move 1 from 5 to 4
move 3 from 4 to 3
move 1 from 7 to 6
move 1 from 2 to 7
move 1 from 1 to 2
move 3 from 9 to 1
move 1 from 6 to 2
move 2 from 2 to 6
move 17 from 3 to 6
move 1 from 8 to 3
move 1 from 5 to 4
move 2 from 7 to 2
move 9 from 9 to 8
move 1 from 9 to 3
move 16 from 3 to 2
move 1 from 7 to 5
move 5 from 6 to 5
move 1 from 1 to 6
move 1 from 4 to 1
move 1 from 9 to 3
move 9 from 8 to 6
move 3 from 1 to 5
move 1 from 9 to 1
move 16 from 2 to 1
move 2 from 2 to 7
move 2 from 3 to 9
move 2 from 7 to 4
move 2 from 9 to 3
move 3 from 3 to 5
move 1 from 4 to 5
move 1 from 4 to 2
move 1 from 1 to 7
move 1 from 7 to 1
move 1 from 3 to 6
move 2 from 5 to 1
move 3 from 6 to 2
move 2 from 5 to 8
move 8 from 5 to 4
move 1 from 5 to 3
move 1 from 3 to 2
move 1 from 8 to 3
move 1 from 3 to 8
move 4 from 1 to 7
move 9 from 1 to 7
move 6 from 1 to 8
move 3 from 7 to 4
move 7 from 6 to 7
move 11 from 4 to 3
move 2 from 3 to 8
move 8 from 3 to 8
move 4 from 6 to 1
move 1 from 7 to 4
move 2 from 1 to 2
move 8 from 7 to 2
move 1 from 4 to 8
move 10 from 8 to 2
move 2 from 6 to 1
move 1 from 1 to 4
move 1 from 4 to 8
move 2 from 1 to 4
move 6 from 6 to 5
move 1 from 1 to 9
move 2 from 6 to 8
move 1 from 4 to 5
move 1 from 6 to 9
move 4 from 8 to 9
move 1 from 7 to 1
move 6 from 8 to 6
move 1 from 6 to 1
move 1 from 4 to 9
move 2 from 9 to 5
move 5 from 5 to 9
move 8 from 9 to 5
move 2 from 8 to 5
move 3 from 6 to 9
move 8 from 5 to 7
move 5 from 5 to 6
move 1 from 9 to 2
move 1 from 3 to 1
move 1 from 6 to 7
move 1 from 5 to 6
move 24 from 2 to 4
move 3 from 9 to 7
move 16 from 4 to 5
move 2 from 1 to 3
move 12 from 5 to 6
move 1 from 9 to 5
move 4 from 5 to 9
move 1 from 1 to 6
move 1 from 5 to 2
move 2 from 9 to 8
move 1 from 8 to 1
move 5 from 4 to 5
move 2 from 3 to 5
move 1 from 8 to 3
move 1 from 1 to 6
move 3 from 5 to 7
move 1 from 9 to 1
move 1 from 2 to 8

View File

@ -1,3 +0,0 @@
with open('input.txt', 'r') as f:
stream = f.read()
print([i+4 for i in range(len(stream)) if i < (len(stream)-4) and stream[i] not in stream[i + 1:i + 4] and stream[i + 1] not in stream[i + 2:i + 4] and stream[i + 2] != stream[i + 3]][0])

View File

@ -1,21 +0,0 @@
def main():
with open('input.txt', 'r') as f:
stream = f.read()
for i in range(len(stream)):
if validate(stream[i:i+14]):
print(i+14)
return
print('No valid marker')
def validate(part_string: str) -> bool:
for i in range(len(part_string)):
for j in range(len(part_string)):
if i != j and part_string[i] == part_string[j]:
return False
return True
if __name__ == "__main__":
main()

View File

@ -1 +0,0 @@
tzltzltthfthtdtstftbfbnffdjjvnvcccnznpndppsvvlnvlnvndntnllwffvwwcpwccssqbqnbbwzbwwfjjscspspfsfvvzjvvmjvjwjljbbbqtbbcqbccdqcdcpddnvnjvvqwwbrbggjllhbbzlblrrrcwwrfrmffgddfsddnqnqpnnmzzwlzwzqwqgqnngnfnvnhvvfnvvszzrbrqbqnbbrsbsvssgngwgqwqbqsbsvbbdvdfvdvbbqlqdlqdllnppwcclwlvwlwjlwwdjjjcschhhmrrnnrznzlnnwmnwnfngghngnpggmrrzrttdbdtddjhdhrrqddnhnjjntjtbtmtffwcfcnfcnfnjjfnjfjjhrhhgfgttgmttltfllfqfnqqcbbrlblrbrcrssrllhddmnddmcdddvttfdfqfmqqcncggczczdccvhcvcjvvgnnqttltcchzhjjwmmqvqtqnqbbhddcqdccnwccttgwwzssncncjjprjjpbprrndnrnrhnhrnhngnhhbjbccpmpmrppjvpjpqjjsvjjhttcclmmqzzlggtqqqgdqqbhhtmmqfmqmwmjwmjmmnsmsvsrrvpvhhtshhhmqmdqqqqlfffwgwhwjjrfjfmfrmffgzzjvzznqqwggcvcnvvcpvpjpjbpbrpbrrzhhcffqqlzzrmzrmzmzrrqdqrqnqrnrnqnrnsrrnjrrgllgqlljldjjmvvqbqhhsmsmddsfdddcmmphhtjhjzhjjjhcjjzppwhwvvdnvnvpnvnlnvnffrjjtzzdqzzngzgqghhmvvgwwqhwhlhvvfzzdpzddtbdtbtvtlvlqlllvvdvsdsslccbscsbbcggldlvvdccdscdsdzsddpggcfggnffpjpnpcncfcqqlvvszzbpbqbcqczcqzcqzqqlrlwwbgglrrbgbhhlbbsffrprtpppdwdhwhbbpssvbvnntbbfnfddmmfcfcjfftbfbdbccngcgjcjtjftjffrwwtwlwddczcnzczpzcpccrqcrczrzcrzzhnntgtqgtgztgzzcpphshwswfwqqnzngzzbpzzpqpzqznzdzmzqqjzzhnhvnnqjnnrdrcctdtppsffzvvwvbbpttsrsspsddfvvfllrtlljpjlplcctthbbgbqgbgmmpwpvvghvhfhwfwcwvwrvwrvvcgccdncddbmbmfmlffgqggrzgzhhzfzdfzfhhzdhzhjzjhhbffrtrjtthssbpspddpttrggdndsnnjwwzrwrvvmqvmvdvhvjvnnqmmhrhrzzzwttnftfddsdfsfjsjcccvhvgvgzvgzvzbvvhwhbbpccfjfllgmlggtbggdsgsmmmnznqnhqhrqhrrtthwhqqvzqvvvqgqffpvptvpvwvbvsscsnnhlnhhzrzjrjrllcffpqpbpsbbflblppqffbqqpttccdgcgdgfdfgdgjddjljpljppdspddflftllhchmcmwcwddrqqsdsswwmwwwjdjvdvwwcgcddmhhqtqvqmvvnffqppnvpphpnnshsmhmdhmdddlnlmnmsnnpttlfttnqnhqnqrnrddplplbpbdpdhppccbnbwwpwzwgwdgdnggcmmtnmnznmzmwmrmtrrjppjgjmggndgnnjzzrczzftztzgzvgvddgmdgmgpmmgjmmnrrmvmnvvhqqggsnnplnlnbbrcbbpphssnqsnspnncfchhvjjdjvjfjddbjbddhlllpdnrhtzhqpphzfbjclncdlrbtzhcwslpnstdvjslnzfrvfdlmpgpfhrqtjvqvjlqgdcjrbjtjrgvbfwjzsvrbmffnhvjqnshvdjbgwmpwlfjznngzpqbvlztnvgvjsnwvhpfwbhfsmjgwwjdrrwbtvpwtzvjfhwrmnrhdsvgpgdsfgndmffqfplsgjrsvztzlznqsrbldbmmhqmjtrzscrbwlpgztlrvllprnhzsvtnvwzmjwqhqpjqhntcrscwcdnwzpvbdczzcmzrmdwthdtszqzftcsfbwfqggpcntfrgwpmjpdzjnczwcjmdjnrqjfwqbznznmcdvzqlpqschnmcfqjjrjwfmqqftfdhdzffvshqbmrgrpvlgqcgsbsngttvcpjswdgrhbblrhjllfbzngqjzzbdwtnlnrbpftvwbmrhvcnntdrbvtrtpcsqdsrvpsgggfpwcbzhwhwmmmmmgjzgdtwnzjdwjfljghbjvjnsgshmdpztnbbrnwfvzhtzqpzttftdmcmqzlnrgncwwtpwqrgmpmwwchwhbbbblcndbsrrqtnztcmqhvdwfcswnswvhqdtqfdrhjgczqvrzqczmnpcgbwntjvlsfrzrrjtsvfzfmbwwsftwqvttpjvbggrlcspnfhwwmrhdbbhdcjvmrhppvcmtmfhszjlcjjsdqfvjttcmffwzfpmjmjzhcrqmhhwzhjlnwphvvhmrbllsvpjljthjndffrdbmdjncnmdtcwfwjdwnrdlvqsbzczlhwrtpnzfwzzwbrqpglgvrjsnsprvwszmlrjcdgzwchmcqrjdlzqfvqwwfszpptprhcfsdfcrnhvhgvcdwgnqzjtmgznltbjjqwzlljrqcmpdncshzvsmvjwlmvtwbtjcgmqfslvwcfqpljzdjmdvqjlztbsbshcwhlvzcmzljvrrhrbzwvthgtnszpcrrdwcmtdncdzlbdscfbhrlqttcfshqrsgvzhlcnvfhppdqvblsznmctftmnslwgbmbgshgwvmzpdnmqmjgqnvrwprmbzrdprrbcwnslczvzgnssjqqzdrlntrnsrgbjjcpqvnqwvnwgslchqzbphcqsbvgvwzlnsndfrhqjvtlnqpcsgswzfvhjmfgwgfvhjgzntdbztmjsbmtwlfmvvgvztvwwmqclcgctqbvljgfngcvfqlmmvqmbtrnnbhqjjndzqhvvdztjgvwgrtltfrlzrjcpgwvpqwmcwmqccjtjhhbrrqphlpljvhjzpdfcdsgzfpnzdzhfdqjsnrvmwstrmmwmlhbvrjbtnmvwcqnzqzzpwzjdnfhqwwlsvgnnjgffzcnrtbjfwllnrgppchqwnfpwpgnfbvwcbjrlscnwlswjmnrcrhtdhgpzvgtfcqzgqtwvlhrgbmjvvzhrlzfvmrdjjctvfwsgmjwbqslhmjlcvlwrdqfmbhcfrmrvqtslplwpsgrfmntmtvmvqttbspmftgqdzlcfplcvvfmmjttwqjpdtjzzsfjcprvbwdvfrpzddhwrlmsnpjzqgdlfdzvdjnjtgtfflzzvjlmnnvmglrptsnppwscznltcvzfjmwshnsqsvsjpqwsqlbwzslhgrdcbbvcjspqfntbcpwwrphgpmwbpqdcfvvtlsgpfshtcrdftsltwnbnmzfwcwlmrhlntmmnnpsdchvntcwbnmjdgwcmzzvbrhbdbmlgwppzwsqvcccdbfzfsfhtmbppnwbtjvrvjtmddhmrjdqgnmrnjjpqsgtbgcvtclzzstlpldtqbnnvqjfbjcfzblvcwhjphzcgwfljjhzzmwdcrzsssznztcwpjlbcffnlmsfjbmtvhhcljmtqdprdmdgwgpnnlmhgwpsgprfqnspmntrdjwjmrflsbfpqhzswbsrdbdhjmvtwmjjnmpllgfllzgwwmswjcmggbrvsbbhjmsdzzpbhbrlphwdsmjdzsqjfrmdmpljnwscjrhdvzqbhhvpmhwqfrrhzlncrrrzhmjdwqjcbsqjbhbdbjzpslrnnbzctnnlhqmqqbdzfbrpfgwsrdglnplpspnnqhtbhzhzgtchcbqcmmcmvlllczqbtmbstzmnlhhhbmmbtjwnbgwjbfhgvfhqlsgdnnrsgghjzjlqfwbbgztdqzbhhwhcwtjwsgstjpzcjjvqbpfpvlqfqshvfzbwmfcwfgqvgmbppfvzgzznzhsqbvzlztsnmnrbgqzbmbhlvqhfncdfcpttgzpvvzdbhvqdtqsblqvrsrnmsfbqhrpvlzffdzptzghvmbmdzjrsqzhqddqm

View File

@ -1,25 +0,0 @@
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()

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
import load_map
def main():
tree_map = load_map.load_map()
visible_from_outside_count = 0
not_visible_from_outside_count = 0
for i in range(len(tree_map)):
for j in range(len(tree_map)):
if i == 0 or i == len(tree_map)-1 or j == 0 or j == len(tree_map)-1:
visible_from_outside_count += 1
elif (max(tree_map[i][:j]) < tree_map[i][j]
or max(tree_map[i][j+1:]) < tree_map[i][j]
or max(get_column_until_i(tree_map, j, i)) < tree_map[i][j]
or max(get_column_from_i(tree_map, j, i+1)) < tree_map[i][j]):
visible_from_outside_count += 1
else:
not_visible_from_outside_count += 1
print(f"Visible from outside: {visible_from_outside_count}\nNot visible from outside: {not_visible_from_outside_count}")
def get_column_until_i(lst: list[list[int]], column_id: int, end_i: int) -> list[int]:
column: list[int] = []
for i in range(end_i):
for j in range(len(lst[i])):
if j == column_id:
column.append(lst[i][j])
return column
def get_column_from_i(lst: list[list[int]], column_id: int, begin_i: int) -> list[int]:
column: list[int] = []
for i in range(begin_i, len(lst)):
for j in range(len(lst[i])):
if j == column_id:
column.append(lst[i][j])
return column
if __name__ == "__main__":
main()

View File

@ -1,47 +0,0 @@
import load_map
def main():
tree_map = load_map.load_map()
highest_score = 0
for i in range(len(tree_map)):
for j in range(len(tree_map[i])):
if i == 0 or j == 0:
continue
current_tree = tree_map[i][j]
current_tree_score = 1
direction_count = 0
for k in range(i-1, -1, -1):
direction_count += 1
if tree_map[k][j] >= current_tree:
break
current_tree_score *= direction_count
direction_count = 0
for k in range(j-1, -1, -1):
direction_count += 1
if tree_map[i][k] >= current_tree:
break
current_tree_score *= direction_count
direction_count = 0
for k in range(i+1, len(tree_map)):
direction_count += 1
if tree_map[k][j] >= current_tree:
break
current_tree_score *= direction_count
direction_count = 0
for k in range(j+1, len(tree_map[i])):
direction_count += 1
if tree_map[i][k] >= current_tree:
break
current_tree_score *= direction_count
if current_tree_score > highest_score:
highest_score = current_tree_score
print(f"Highest score: {highest_score}")
if __name__ == "__main__":
main()

View File

@ -1,99 +0,0 @@
131210223122034201100050105424523044130411422315401641602244345313413050154142511210232230010113310
311013023144242433041451004544121455454620031355066511426335055503430442412031400134421222323200231
000000231023234100542524312250523355415365261251616530425625664621215121033040340113311421124403120
112300444001303041405153523535126435661025243650554326352462442340031244522333142343310234422042101
011212224431121423533535502254210263641435632425025530513616353113250430340323201235001322302202112
202112313203021131220031503364123020251021060003210224226552235425544614111231232422312141400320413
200444200302403233024104523503202601044223254222154626546510545561110210263213430521241312421430303
004102313211311304304014024303123532011445320262467355722501012602644242025103522053013251103111002
304431411242103200225521661431265142636476475774766762762162363612154012423154144521032044323220414
431010040140112455335030032360262556456443775453334565671317716550430136651202313511214502241202330
043110240102454224516544224630616266622151633641416574141573472553733643035156556442540112231022330
344001014540504225063305264264244355672617755344543332512133532145451255143634431525512440433123411
113143353104203351103602240424523453451134364517415112721516225167142625124311653430211020140140033
342424105441510440330522410035715716774467613477463165551222537127247464353412121551250032130221402
410022504110015140563646535637544514224772163251875687177773617131666312426516653364620212210230313
211041303415212543246450027775344644111513854625668347224721545553312454276112266113006550101452023
122004120501250326115204667575557541115833886847258462846234567626374111773571244513654010011342043
301350253554662030333624245656331336684563833452867366254385562353677252735134322645443400000505332
245553522153032254411763514675764155633476526675325578425443428557445775637465473664541400534333232
322442130433125464663414766715267753434324555463784727253433653632683735371446657522664436422521413
331053445014305402543221122137356667287622582365352535357653444332458554753476126241266505611211314
132305431204423645643332442378265875383382785757384646688636277356473225215656144464631013404513545
053434505352362212362322254526384368455578549563664455533528348238256867477226167554313140041401143
203253201234236243775741122764852566323853963388779975599397567878847548722235622474163122662031025
104312526333250166615172668583238338723855457693768963653558894638325372838152126473716643303600351
300033325433641325623235156626436335535335388847464645964634799646746246766834574361166125456122351
120451143220054517417432222372537276354686677646995668437869779369928258788534513761754512104013333
533230405632016226763328844653255879987575353774339563955877645966846826356373371671142605624114450
344214406630075321522734573335883369387497369848437466643758736756744863635423414516662160242011015
153451326406137727666257774235355975796748378956899755978495944398847342278543532717554136340636511
024120564062654627732368525228793638475545556576899665765756673653534943354538526752326643260141204
412203404021155532277533544576338345978848669679757658576464434458866475384364264335343563643142455
524002156645642574176682747734737558688944465667846776898785795455858947565382387667331113015066451
113326321336515741227873667767747863748957949856994566445966947557698763647356484312144362112035661
434431122332456363585644236338986386449886459969898794477784876859584934744448487422233247433555125
554200316641747712525646475695585944855767864476587785657648489858488643964822385635771521136623046
052645555643364326224256887465763984499555456786655996459854588687984483443425342327437117204051333
324343644132162478234438235893544695988896887697765955598567945698759463346462838746232654576440215
462521542732624633374484345633767949856985955975898956868594588984946798839592836667471162150441636
304026636645461478734587878689834446685557768558895888866986985488496437548446368538251171154630512
101552533162346275323229586354898455686576855758557778659698597964984437888644223388226555216163411
226105531714231626224846935734356584745868996975697659897867984899744976774696753265736467266365363
545055625455625875447559864667957979647968997958989658678889877465465468549376486535366137522210053
232635236714655674743537653457749846596956975956766868889657789549747795675485857275755452342405631
336205405746366588226663467669498957868656755776686987887868569798659876543375846338247764415355462
155141051431316677636748574867789558675986588998679878868759877859999565576663475662435765647005340
232654031116753272825747668968554669668677998669769697669576866955596675964889624528726432263222616
046125447675236746223768668449879754576588858988996889696887777774597744733788336362244612637553514
332536552224754343576649855595666484566675788668896786768988988769569579999834385254427632624650030
460234671543372887673258495575749597595556689798666968989999596584956587675793948224673776637134104
542551244113357255333348985978787695699886688996687688989678979668986898375478542858365611723122044
436025232763148825472748645398546496988875698898869977888888759686766658866855938347566311743605100
041352435563335243486289834394558775588869568696989689688668679659674985985749374752633143335411605
645651613323411838844847964446478646777866888967786698987886597984667558653798334378662326523323316
453251236357514443523673467349998744667597789678969978697885696567487655374593857785247555435556045
125626067513221885878857759866589459898567986669876767888879686774468986669574866876872256777244651
061632634136353483585356796789964457467578899876878869685969688887694989435735523286834312755525066
340540044551242754354545465975657758685657898679669667967695977988789866474643553377742333237366424
263036352242131347425624853533685546887657969789867597887875857754448643936644634734681251565046213
521221014252416228623283758687657746455765599789696566599868586857544488568349257532612223352106620
551056515565333357773577346794385876469668655769579779597857875875996655775847823478875155335563305
033061351361131165452262574439975544867848695885675877665879558695985696596744556573716376424303526
051413453164367157546735796993358565449465886965769896875794786968869649574645557564453516434340036
522012306661675468522365554866664944774645598595765956997799788597559834845664822564673263773400310
303552112356652526736235234953975468449454679549576957655985777498534633999648453476132767604136505
430122433512263557743477259647593668744879856557445598497869544969574539864264546361414462664221411
454611134331624353887744383937939357467695869797758446748645646757337474547364356834125123550540011
205311422445771735787735535567487687866565989949866754567798798789335594675342524621173252621030620
104546314105111141478387738596677754347769889645474649778444486556868546667547447347454232412330210
211510511334467714212764237753489789395879446757548685444899995947477635333458277512623242566130511
424514361505346363172223743443943549786984455999479779995888784953977545326775458231326323010233504
533506406351652124743874362238244995393575576558499944857439678937793742537382237144513564254651535
353553630060426172733685862388329358887865467969479496565936757634945866336662814247313410506123210
513043225146416126342738452268474836363669357555484378683836437894548678424787336776674656521041540
244212015566607562363563332245262634763988943955763374435446957788627758456361246547173556634433112
120250204244540161453135477576577584679685399997348333875938895345463364665351151547550433420451010
255032316662364526536463566477643566873988833997886594683996985547474224255612136321352552052105402
104213510451031021331446321843388442357338856338535749438457984676336446257657625355006562000544113
541445315342554104332147175678875788872263746578533386785725742286747757363143223363002242403240300
250054145114114250444475636452277673763367766534832262225326442862356536367112741723425324561325551
333553132316232331166236712324478868545457256543258752567822364684454281563652476110466630243545012
105553252451444255251516625337126655486536656548634366772767853646345616517533725655446161145113520
025500320531252635012635251245524534532874583455824435258654245466851271721413732103556450032134212
122200331203513436340117775373456645476436746876327282863778274541722364747346544343564664345130314
441320433033461423032344434231635142515424736857357883276527554723561743647654233055512312302104530
204042200400054122313353457757245116453332283484837768668273767612521361442530615235236222154004311
221131430533350565006640022453717233151527675542578563343653736225637243741111121060442013041415121
143234105412111133566044252147564714332714531116676347152755116543123447451004602504145444453253433
320324355203321243353463365121412173726252341762654343152225445674136341343221112445214335524423100
202300215012154413506542142320154422415625511216416742722732625443456234050601116134422203301324102
101234204150414100204253404415020535764151322156246545763562327134761563456554466111402435010443123
431241014215100150231323511544033066474456542763733572523364653251210236631153343300102203501444131
042113314231102110430451540516134616441273312433773513644616643153262013464225504105041102141121134
011110441120300210525243055356613232510501653115647342112643545365615664665363430033144102220342002
022302231313301100120453535411263110120014430464665351336004360420564432406415043521343230142324012
113120323401112034331301531555663250242545635553155553026665545501304141205024555331305404432131422
012114144232442305005303300503446534353541113202335113010041055013513101112435052423113214420112332
230302124240141434221315223103536661161244640554266246312142632216301114101010004305311113412410032
023121121202444024012413530551503240563056005135401560566653254102253143503152511431441042423320132

View File

@ -1,13 +0,0 @@
def load_map() -> list[list[int]]:
with open('input.txt', 'r') as f:
puzzle_input = f.read()
tree_map: list[list[int]] = []
lines = puzzle_input.split('\n')
for i in range(len(lines)):
tree_map.append([])
for j in range(len(lines[i])):
tree_map[i].append(int(lines[i][j]))
return tree_map

View File

@ -1,99 +0,0 @@
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()

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +0,0 @@
# 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 by days:
### 2022
| Language | Days |
|----------|------------------|
| Python | 1, 2, 4, 5, 6, 8 |
| C# | 3 |