1
0
mirror of https://github.com/chylex/Advent-of-Code.git synced 2024-11-25 23:42:47 +01:00

Compare commits

..

No commits in common. "4407184536a25380da48f0bf962faa6eb7720be6" and "59db6f9c82ff3671d62c7f622e9a96cb0edd5374" have entirely different histories.

52 changed files with 160 additions and 294 deletions

1
.gitattributes vendored
View File

@ -1 +0,0 @@
* text=auto eol=lf

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
/.gradle/
/build/
/.idea/compiler.xml
/.idea/dictionaries
/.idea/encodings.xml
/.idea/gradle.xml
/.idea/inspectionProfiles/
/.idea/jarRepositories.xml
/.idea/modules.xml
/.idea/vcs.xml
/.idea/*.iml

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
AdventOfCode

34
.idea/misc.xml Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$/2015">
<contentRoot DIR="$PROJECT_DIR$" />
</component>
<component name="CidrRootsConfiguration">
<sourceRoots>
<file path="$PROJECT_DIR$/2015" />
<file path="$PROJECT_DIR$/2020" />
</sourceRoots>
<excludeRoots>
<file path="$PROJECT_DIR$/.gradle" />
<file path="$PROJECT_DIR$/2020/target" />
<file path="$PROJECT_DIR$/2021" />
<file path="$PROJECT_DIR$/build" />
<file path="$PROJECT_DIR$/gradle" />
</excludeRoots>
</component>
<component name="CodeInsightWorkspaceSettings">
<option name="optimizeImportsOnTheFly" value="true" />
</component>
<component name="ComposerSettings">
<execution />
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="JsFlowSettings">
<service-enabled>true</service-enabled>
<exe-path />
<other-services-enabled>true</other-services-enabled>
<auto-save>true</auto-save>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.4" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project>

View File

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2015 - Day 01" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$PROJECT_DIR$/2015/01" PASS_PARENT_ENVS_2="true" PROJECT_NAME="AOC" TARGET_NAME="AOC_2015_01" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="AOC" RUN_TARGET_NAME="AOC_2015_01">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2015 - Day 02" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$PROJECT_DIR$/2015/02" PASS_PARENT_ENVS_2="true" PROJECT_NAME="AOC" TARGET_NAME="AOC_2015_02" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="AOC" RUN_TARGET_NAME="AOC_2015_02">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2015 - Day 03" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$PROJECT_DIR$/2015/03" PASS_PARENT_ENVS_2="true" PROJECT_NAME="AOC" TARGET_NAME="AOC_2015_03" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="AOC" RUN_TARGET_NAME="AOC_2015_03">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,13 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 01" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<configuration default="false" name="2020 - Day 01" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin 01" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/01" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/2020/01" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="emulateTerminal" value="false" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<envs />
<option name="isRedirectInput" value="false" />

View File

@ -1,13 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 02" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<configuration default="false" name="2020 - Day 02" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin 02" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/02" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/2020/02" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="emulateTerminal" value="false" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<envs />
<option name="isRedirectInput" value="false" />

View File

@ -1,13 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 03" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<configuration default="false" name="2020 - Day 03" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin 03" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/03" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/2020/03" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="emulateTerminal" value="false" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<envs />
<option name="isRedirectInput" value="false" />

View File

@ -1,13 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 04" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<configuration default="false" name="2020 - Day 04" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin 04" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/04" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/2020/04" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="emulateTerminal" value="false" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<envs />
<option name="isRedirectInput" value="false" />

View File

@ -1,13 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 05" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<configuration default="false" name="2020 - Day 05" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin 05" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/05" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/2020/05" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="emulateTerminal" value="false" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<envs />
<option name="isRedirectInput" value="false" />

View File

@ -1,13 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 06" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<configuration default="false" name="2020 - Day 06" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin 06" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/06" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/2020/06" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="emulateTerminal" value="false" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<envs />
<option name="isRedirectInput" value="false" />

View File

@ -1,13 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 07" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<configuration default="false" name="2020 - Day 07" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin 07" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/07" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/2020/07" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="emulateTerminal" value="false" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<envs />
<option name="isRedirectInput" value="false" />

View File

@ -1,13 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 08" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<configuration default="false" name="2020 - Day 08" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin 08" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/08" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/2020/08" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="emulateTerminal" value="false" />
<option name="withSudo" value="false" />
<option name="buildTarget" value="REMOTE" />
<option name="backtrace" value="SHORT" />
<envs />
<option name="isRedirectInput" value="false" />

View File

@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2021 - Day 01" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="MainKt" />
<module name="Advent_of_Code.2021-01" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/01" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2021 - Day 02" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="MainKt" />
<module name="Advent_of_Code.2021-02" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/02" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2021 - Day 03" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="MainKt" />
<module name="Advent_of_Code.2021-03" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/03" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2021 - Day 04" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="MainKt" />
<module name="Advent_of_Code.2021-04" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/04" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

5
2015/.gitignore vendored
View File

@ -1,7 +1,2 @@
/.idea/*
!/.idea/cmake.xml
!/.idea/misc.xml
!/.idea/runConfigurations
/cmake-build-debug/
/cmake-build-release/

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration">
<sourceRoots>
<file path="$PROJECT_DIR$/01" />
<file path="$PROJECT_DIR$/02" />
<file path="$PROJECT_DIR$/03" />
<file path="$PROJECT_DIR$/utils" />
</sourceRoots>
</component>
</project>

View File

@ -1,7 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 01" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$PROJECT_DIR$/01" PASS_PARENT_ENVS_2="true" PROJECT_NAME="2015" TARGET_NAME="2015_01" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="2015" RUN_TARGET_NAME="2015_01">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,7 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 02" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$PROJECT_DIR$/02" PASS_PARENT_ENVS_2="true" PROJECT_NAME="2015" TARGET_NAME="2015_02" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="2015" RUN_TARGET_NAME="2015_02">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,7 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 03" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" WORKING_DIR="file://$PROJECT_DIR$/03" PASS_PARENT_ENVS_2="true" PROJECT_NAME="2015" TARGET_NAME="2015_03" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="2015" RUN_TARGET_NAME="2015_03">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,4 +1,4 @@
set(PROJECT_NAME 2015_01)
set(PROJECT_NAME AOC_2015_01)
project(${PROJECT_NAME} C ASM_NASM)

View File

@ -1,4 +1,4 @@
set(PROJECT_NAME 2015_02)
set(PROJECT_NAME AOC_2015_02)
project(${PROJECT_NAME} C ASM_NASM)

View File

@ -1,4 +1,4 @@
set(PROJECT_NAME 2015_03)
set(PROJECT_NAME AOC_2015_03)
project(${PROJECT_NAME} C ASM_NASM)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)
project(2015)
project(AOC)
enable_language(ASM_NASM)

View File

@ -1,5 +1,5 @@
#ifndef INC_2015_BENCHMARK_H
#define INC_2015_BENCHMARK_H
#ifndef ADVENTOFCODE_BENCHMARK_H
#define ADVENTOFCODE_BENCHMARK_H
#include "stdio.h"
@ -64,4 +64,4 @@ void runBenchmark(const entryPointCallback ep, char* input) {
#undef BENCHMARK_RUNS
#endif //INC_2015_BENCHMARK_H
#endif //ADVENTOFCODE_BENCHMARK_H

View File

@ -1,5 +1,5 @@
#ifndef INC_2015_FILE_H
#define INC_2015_FILE_H
#ifndef ADVENTOFCODE_FILE_H
#define ADVENTOFCODE_FILE_H
#include "stdio.h"
#include "stdlib.h"
@ -65,4 +65,4 @@ char* readFile(const char* filename) {
return contents;
}
#endif //INC_2015_FILE_H
#endif //ADVENTOFCODE_FILE_H

3
2020/.gitignore vendored
View File

@ -1,4 +1 @@
/.idea/*
!/.idea/runConfigurations
/target/

View File

@ -1,5 +1,3 @@
#![allow(dead_code)]
use std::error::Error;
use std::fmt::{Debug, Display, Formatter};
use std::fs::File;
@ -12,6 +10,7 @@ pub fn read_input_lines() -> Result<Vec<String>, io::Error> {
return BufReader::new(file).lines().collect();
}
#[allow(dead_code)]
pub fn parse_input_lines<T : FromStr>() -> Result<Vec<T>, Box<dyn Error>> where <T as FromStr>::Err : Into<Box<dyn Error>> {
return read_input_lines()?.iter().map(|line| line.parse::<T>()).collect::<Result<Vec<T>, T::Err>>().map_err(Into::into);
}

5
2021/.gitignore vendored
View File

@ -1,5 +0,0 @@
/.idea/*
!/.idea/runConfigurations
/.gradle/
/build/

View File

@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 01" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="01" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 02" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="02" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 03" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="03" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 04" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="04" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 05" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="05" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 06" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="06" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 07" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="07" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 08" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="08" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1 +0,0 @@
rootProject.name = "2021"

View File

@ -8,25 +8,19 @@ I have included Run Configurations for JetBrains IDEs, so if you use the appropr
## \[2021\] Kotlin
The repository contains a Gradle project (`2021/build.gradle.kts`) that sets up every day as a source root and a task that can be launched with `gradlew <day>`, for ex. `gradlew 01`.
You should be able to load the Gradle project into [IntelliJ IDEA](https://www.jetbrains.com/idea/).
The repository contains a Gradle project (`build.gradle.kts`) that sets up every day as a module. You should be able to load the Gradle project into [IntelliJ IDEA](https://www.jetbrains.com/idea/).
The source code is in `main.kt`. The run configuration executes the `main()` method in this file.
## \[2020\] Rust
The repository contains a Cargo project (`2020/Cargo.toml`) that sets up every day as a binary target that can be launched with `cargo run --bin <day>`, for ex. `cargo run --bin 01`.
You should be able to load the Cargo project into [CLion](https://www.jetbrains.com/clion/).
The repository contains a Cargo project (`2020/Cargo.toml`) that sets up every day as a binary target that can be launched with `cargo run --bin <day>`, for ex. `cargo run --bin 01`. You should be able to load the Cargo project into [CLion](https://www.jetbrains.com/clion/).
The source code is in `main.rs`. The run configuration executes the `main()` function in this file.
## \[2015\] NASM x64 Assembly
The repository contains a CMake project (`2015/CMakeLists.txt`) in the respective year's folder, which sets up every day as a CMake subproject.
You should be able to load the CMake project into [CLion](https://www.jetbrains.com/clion/), as long as you have a toolchain named `Visual Studio x64` set to use the `amd64` architecture.
The repository contains a CMake project (`2015/CMakeLists.txt`) in the respective year's folder, which sets up every day as a CMake subproject. You should be able to load the CMake project into [CLion](https://www.jetbrains.com/clion/), as long as you have a toolchain named `Visual Studio x64` set to use the `amd64` architecture.
The source code is in `main.c`, which is either in the puzzle's own folder, or in `utils` if no adjustments are needed. By default, `main.c` reads the whole input file into a buffer, and passes it as a parameter to the `entryPoint` function defined in `main.asm` which implements the logic and output of each puzzle.

View File

@ -1,12 +1,10 @@
@file:Suppress("ConvertLambdaToReference")
plugins {
kotlin("jvm") version "1.6.0"
idea
}
group = "com.chylex.adventofcode"
version = "1.0"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
@ -21,14 +19,16 @@ idea {
file(".gradle"),
file("build"),
file("gradle"),
file("2015"),
file("2020")
))
}
sourceSets {
fun make(day: Int) {
fun make(year: Int, day: Int) {
val paddedDay = day.toString().padStart(2, '0')
val sourceFolder = file(paddedDay)
val sourceFolder = file("$year/$paddedDay")
val resourceFolder = sourceFolder.resolve("input")
if (!sourceFolder.exists()) {
@ -38,21 +38,18 @@ sourceSets {
resourceFolder.resolve("1.txt").writeText("")
}
create(paddedDay) {
create("$year-$paddedDay") {
java.setSrcDirs(listOf(sourceFolder))
resources.setSrcDirs(listOf(resourceFolder))
}
tasks.register<JavaExec>(paddedDay) {
group = "run"
mainClass.set("MainKt")
workingDir = sourceFolder
classpath = sourceSets[paddedDay].runtimeClasspath
}
}
for (day in 1..8) {
make(day)
}
make(2021, 1)
make(2021, 2)
make(2021, 3)
make(2021, 4)
make(2021, 5)
make(2021, 6)
make(2021, 7)
make(2021, 8)
}

View File

View File

1
settings.gradle.kts Normal file
View File

@ -0,0 +1 @@
rootProject.name = "Advent of Code"