day one commit

master
cyberdick 2022-12-01 23:39:04 +05:30
commit 60c907a38a
7 changed files with 2373 additions and 0 deletions

7
.gitignore vendored 100644
View File

@ -0,0 +1,7 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
.idea/
.vs/

View File

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

View File

@ -0,0 +1,69 @@
namespace AOCDayOne;
internal static class Program
{
private static async Task Main(string[] args)
{
switch (args.Length)
{
case 0:
Console.WriteLine("Nigga enter the filename!");
break;
case 1:
{
var result = await ProcessElfFoodListFile(args[0]);
if (result is not null)
{
Console.WriteLine($"Fattest fucker has {result[0]} borgers");
Console.WriteLine($"Top 3 Fatties have {result.Take(3).Sum()} borgers");
}
else
{
Console.WriteLine("Processing error/File not found");
}
break;
}
default:
Console.WriteLine("I don't even know what the fuck you typed, just the filename as argument");
break;
}
}
private static async Task<List<int>?> ProcessElfFoodListFile(string filename)
{
//Set Current Directory in launchSettings.json or rider launch profiles
//var currentDirectory = Directory.GetCurrentDirectory();
if (!File.Exists(filename)) return null;
try
{
var lines = await File.ReadAllLinesAsync(filename); //no i dont care about memory poorcels out
var elfFoodSum = 0;
var elfFoodSumList = new List<int>();
foreach (var line in lines)
{
if (!string.IsNullOrWhiteSpace(line))
{
elfFoodSum += int.Parse(line);
}
else
{
elfFoodSumList.Add(elfFoodSum);
elfFoodSum = 0;
}
elfFoodSumList.Sort((x, y) => y.CompareTo(x));
}
//elfFoodSumList.ForEach(Console.WriteLine);
//Console.WriteLine(elfFoodSumList.Count);
//Console.WriteLine(elfFoodSumList.Max());
return elfFoodSumList;
}
catch (Exception ex)
{
Console.WriteLine($"Shieeeeeeeetttt I Crashed!! coz of this {ex}");
}
return null;
}
}

View File

@ -0,0 +1,9 @@
{
"profiles": {
"InputTxtParam": {
"commandName": "Project",
"commandLineArgs": "input.txt",
"workingDirectory": ".\\"
}
}
}

2250
AOCDayOne/input.txt 100644

File diff suppressed because it is too large Load Diff

25
AdventOfCode.sln 100644
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33122.133
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AOCDayOne", "AOCDayOne\AOCDayOne.csproj", "{9A5F75A3-4FD2-4CE1-9047-639AE19F86A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9A5F75A3-4FD2-4CE1-9047-639AE19F86A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A5F75A3-4FD2-4CE1-9047-639AE19F86A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A5F75A3-4FD2-4CE1-9047-639AE19F86A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A5F75A3-4FD2-4CE1-9047-639AE19F86A1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9545A557-8BCE-4791-A5FC-CD5425B85105}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=borgers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Shieeeeeeeetttt/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>