Skip to content

Commit

Permalink
import 2016
Browse files Browse the repository at this point in the history
  • Loading branch information
Magiczne committed Nov 11, 2024
1 parent 541416d commit eaaa2e4
Show file tree
Hide file tree
Showing 77 changed files with 8,726 additions and 1 deletion.
94 changes: 94 additions & 0 deletions 2016/AdventOfCode.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 2", "Day 2\Day 2.csproj", "{C7E33405-56B4-410E-96E9-83324BCD21D7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 1", "Day 1\Day 1.csproj", "{CE9AD3A7-273D-4B3C-9342-CAE0732701B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 3", "Day 3\Day 3.csproj", "{4A17CE1B-663C-4648-91A7-18438B73DC1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 4", "Day 4\Day 4.csproj", "{EDB37B1F-7136-4367-B308-345097F23E8B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 5", "Day 5\Day 5.csproj", "{CAADE80F-0E11-42DF-B8C4-8ABBB88FD792}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 6", "Day 6\Day 6.csproj", "{C4722C04-817E-4CFD-888E-0B072B44FA50}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 7", "Day 7\Day 7.csproj", "{AA432B32-696D-4FCB-A368-04EA5EAD412C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 8", "Day 8\Day 8.csproj", "{2FB4D396-F28C-4550-97D9-244163E7BF5A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 9", "Day 9\Day 9.csproj", "{6B080033-4E61-4797-BD86-3B0DFF402992}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 10", "Day 10\Day 10.csproj", "{242BCB5A-D7E4-48B4-9419-85B662CA631F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 12", "Day 12\Day 12.csproj", "{E390E9D9-59AA-4415-B45C-DD5F95713CA0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 13", "Day 13\Day 13.csproj", "{5EABC966-F7B0-42A6-A518-0DA85BEA2CD6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day 14", "Day 14\Day 14.csproj", "{46DD5DE0-0C9F-4A88-9374-10573DB37003}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C7E33405-56B4-410E-96E9-83324BCD21D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7E33405-56B4-410E-96E9-83324BCD21D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7E33405-56B4-410E-96E9-83324BCD21D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7E33405-56B4-410E-96E9-83324BCD21D7}.Release|Any CPU.Build.0 = Release|Any CPU
{CE9AD3A7-273D-4B3C-9342-CAE0732701B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE9AD3A7-273D-4B3C-9342-CAE0732701B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE9AD3A7-273D-4B3C-9342-CAE0732701B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE9AD3A7-273D-4B3C-9342-CAE0732701B8}.Release|Any CPU.Build.0 = Release|Any CPU
{4A17CE1B-663C-4648-91A7-18438B73DC1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A17CE1B-663C-4648-91A7-18438B73DC1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A17CE1B-663C-4648-91A7-18438B73DC1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A17CE1B-663C-4648-91A7-18438B73DC1B}.Release|Any CPU.Build.0 = Release|Any CPU
{EDB37B1F-7136-4367-B308-345097F23E8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EDB37B1F-7136-4367-B308-345097F23E8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDB37B1F-7136-4367-B308-345097F23E8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDB37B1F-7136-4367-B308-345097F23E8B}.Release|Any CPU.Build.0 = Release|Any CPU
{CAADE80F-0E11-42DF-B8C4-8ABBB88FD792}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CAADE80F-0E11-42DF-B8C4-8ABBB88FD792}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAADE80F-0E11-42DF-B8C4-8ABBB88FD792}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAADE80F-0E11-42DF-B8C4-8ABBB88FD792}.Release|Any CPU.Build.0 = Release|Any CPU
{C4722C04-817E-4CFD-888E-0B072B44FA50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4722C04-817E-4CFD-888E-0B072B44FA50}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4722C04-817E-4CFD-888E-0B072B44FA50}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4722C04-817E-4CFD-888E-0B072B44FA50}.Release|Any CPU.Build.0 = Release|Any CPU
{AA432B32-696D-4FCB-A368-04EA5EAD412C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA432B32-696D-4FCB-A368-04EA5EAD412C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA432B32-696D-4FCB-A368-04EA5EAD412C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA432B32-696D-4FCB-A368-04EA5EAD412C}.Release|Any CPU.Build.0 = Release|Any CPU
{2FB4D396-F28C-4550-97D9-244163E7BF5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FB4D396-F28C-4550-97D9-244163E7BF5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FB4D396-F28C-4550-97D9-244163E7BF5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FB4D396-F28C-4550-97D9-244163E7BF5A}.Release|Any CPU.Build.0 = Release|Any CPU
{6B080033-4E61-4797-BD86-3B0DFF402992}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B080033-4E61-4797-BD86-3B0DFF402992}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B080033-4E61-4797-BD86-3B0DFF402992}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B080033-4E61-4797-BD86-3B0DFF402992}.Release|Any CPU.Build.0 = Release|Any CPU
{242BCB5A-D7E4-48B4-9419-85B662CA631F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{242BCB5A-D7E4-48B4-9419-85B662CA631F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{242BCB5A-D7E4-48B4-9419-85B662CA631F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{242BCB5A-D7E4-48B4-9419-85B662CA631F}.Release|Any CPU.Build.0 = Release|Any CPU
{E390E9D9-59AA-4415-B45C-DD5F95713CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E390E9D9-59AA-4415-B45C-DD5F95713CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E390E9D9-59AA-4415-B45C-DD5F95713CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E390E9D9-59AA-4415-B45C-DD5F95713CA0}.Release|Any CPU.Build.0 = Release|Any CPU
{5EABC966-F7B0-42A6-A518-0DA85BEA2CD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EABC966-F7B0-42A6-A518-0DA85BEA2CD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EABC966-F7B0-42A6-A518-0DA85BEA2CD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EABC966-F7B0-42A6-A518-0DA85BEA2CD6}.Release|Any CPU.Build.0 = Release|Any CPU
{46DD5DE0-0C9F-4A88-9374-10573DB37003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46DD5DE0-0C9F-4A88-9374-10573DB37003}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46DD5DE0-0C9F-4A88-9374-10573DB37003}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46DD5DE0-0C9F-4A88-9374-10573DB37003}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions 2016/Day 1/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
64 changes: 64 additions & 0 deletions 2016/Day 1/Day 1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CE9AD3A7-273D-4B3C-9342-CAE0732701B8}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AdventOfCode</RootNamespace>
<AssemblyName>AdventOfCode</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Direction.cs" />
<Compile Include="Point.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="input.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
10 changes: 10 additions & 0 deletions 2016/Day 1/Direction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace AdventOfCode
{
internal enum Direction
{
North = 1,
East = 2,
South = 3,
West = 4,
}
}
23 changes: 23 additions & 0 deletions 2016/Day 1/Point.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace AdventOfCode
{
internal class Point : IEquatable<Point>
{
private int X { get; }
private int Y { get; }

public int Distance => Math.Abs(X) + Math.Abs(Y);

public Point(int x, int y)
{
X = x;
Y = y;
}

public bool Equals(Point other)
{
return other != null && (X == other.X && Y == other.Y);
}
}
}
79 changes: 79 additions & 0 deletions 2016/Day 1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AdventOfCode
{
internal static class Program
{
private static string _input;

private static Direction _currentDirection = Direction.North;

private static int _distanceVertical;
private static int _distanceHorizontal;

private static bool _crossingFound;
private static Point _firstCrossed;
private static readonly List<Point> Visited = new List<Point>();

private static void Main()
{
_input = File.ReadAllText("../../input.txt");

var instructions = _input.Split(new[] {", "}, StringSplitOptions.None);

foreach (var i in instructions)
{
if (i[0] == 'R') _currentDirection++;
else _currentDirection--;

if (_currentDirection > (Direction) 4) _currentDirection = Direction.North;
if (_currentDirection < (Direction) 1) _currentDirection = Direction.West;

var steps = int.Parse(i.Substring(1));

for (var j = 1; j <= steps; j++)
{
switch (_currentDirection)
{
case Direction.North:
_distanceVertical++;
break;
case Direction.West:
_distanceHorizontal--;
break;
case Direction.South:
_distanceVertical--;
break;
case Direction.East:
_distanceHorizontal++;
break;
default:
throw new ArgumentOutOfRangeException();
}

var point = new Point(_distanceHorizontal, _distanceVertical);

if (!_crossingFound)
{
if (Visited.Contains(point))
{
_firstCrossed = point;
_crossingFound = true;
}
}

Visited.Add(point);
}
}

Console.WriteLine("Answers: ");
Console.WriteLine("*: " + Visited.Last().Distance);
Console.Write("**: " + _firstCrossed.Distance);

Console.Read();
}
}
}
36 changes: 36 additions & 0 deletions 2016/Day 1/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AdventOfCode")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdventOfCode")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ce9ad3a7-273d-4b3c-9342-cae0732701b8")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
1 change: 1 addition & 0 deletions 2016/Day 1/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
L4, L3, R1, L4, R2, R2, L1, L2, R1, R1, L3, R5, L2, R5, L4, L3, R2, R2, L5, L1, R4, L1, R3, L3, R5, R2, L5, R2, R1, R1, L5, R1, L3, L2, L5, R4, R4, L2, L1, L1, R1, R1, L185, R4, L1, L1, R5, R1, L1, L3, L2, L1, R2, R2, R2, L1, L1, R4, R5, R53, L1, R1, R78, R3, R4, L1, R5, L1, L4, R3, R3, L3, L3, R191, R4, R1, L4, L1, R3, L1, L2, R3, R2, R4, R5, R5, L3, L5, R2, R3, L1, L1, L3, R1, R4, R1, R3, R4, R4, R4, R5, R2, L5, R1, R2, R5, L3, L4, R1, L5, R1, L4, L3, R5, R5, L3, L4, L4, R2, R2, L5, R3, R1, R2, R5, L5, L3, R4, L5, R5, L3, R1, L1, R4, R4, L3, R2, R5, R1, R2, L1, R4, R1, L3, L3, L5, R2, R5, L1, L4, R3, R3, L3, R2, L5, R1, R3, L3, R2, L1, R4, R3, L4, R5, L2, L2, R5, R1, R2, L4, L4, L5, R3, L4
6 changes: 6 additions & 0 deletions 2016/Day 10/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Loading

0 comments on commit eaaa2e4

Please sign in to comment.