Prep for 3
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.idea/
|
||||
### https://raw.github.com/github/gitignore/cdd9e946da421758c6f42c427c7bc65c8326155d/Global/macOS.gitignore
|
||||
|
||||
# General
|
||||
@@ -6,7 +7,8 @@
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
28
1.swift
28
1.swift
@@ -1,28 +0,0 @@
|
||||
var depths: [Int] = []
|
||||
|
||||
while let line = readLine() {
|
||||
depths.append(Int(line)!)
|
||||
}
|
||||
|
||||
var total = 0
|
||||
|
||||
for i in 1..<depths.count {
|
||||
if depths[i - 1] < depths[i] {
|
||||
total += 1
|
||||
}
|
||||
}
|
||||
|
||||
print("a:", total)
|
||||
|
||||
var prev = 1000000
|
||||
total = 0
|
||||
|
||||
for i in 1..<depths.count - 2 {
|
||||
let new = depths[i..<i + 3].reduce(0, +)
|
||||
|
||||
if new > prev {
|
||||
total += 1
|
||||
}
|
||||
prev = new
|
||||
}
|
||||
print("b:", total0
|
||||
@@ -6,15 +6,84 @@
|
||||
objectVersion = 55;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
C6615EEB27582F13004CE48D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6615EEA27582F13004CE48D /* main.swift */; };
|
||||
C6615EF627583238004CE48D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6615EF527583238004CE48D /* main.swift */; };
|
||||
C6E4F9052759CCE4001C8B49 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6E4F9042759CCE4001C8B49 /* main.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
C6615EE627582F13004CE48D /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
C6615EF127583238004CE48D /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
C6E4F9002759CCE4001C8B49 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
C6615EE227582D4C004CE48D /* 1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = 1.swift; sourceTree = "<group>"; };
|
||||
C6615EE827582F13004CE48D /* AoC1 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = AoC1; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C6615EEA27582F13004CE48D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
C6615EF327583238004CE48D /* AoC2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = AoC2; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C6615EF527583238004CE48D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
C6E4F9022759CCE4001C8B49 /* AoC3 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = AoC3; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C6E4F9042759CCE4001C8B49 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
C6E4F9092759CDDE001C8B49 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
C6615EE527582F13004CE48D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C6615EF027583238004CE48D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C6E4F8FF2759CCE4001C8B49 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
C6615ECF27582D09004CE48D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C6615EE227582D4C004CE48D /* 1.swift */,
|
||||
C6615EE927582F13004CE48D /* AoC1 */,
|
||||
C6615EF427583238004CE48D /* AoC2 */,
|
||||
C6E4F9032759CCE4001C8B49 /* AoC3 */,
|
||||
C6E4F9092759CDDE001C8B49 /* .gitignore */,
|
||||
C6615ED927582D09004CE48D /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
@@ -22,12 +91,93 @@
|
||||
C6615ED927582D09004CE48D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C6615EE827582F13004CE48D /* AoC1 */,
|
||||
C6615EF327583238004CE48D /* AoC2 */,
|
||||
C6E4F9022759CCE4001C8B49 /* AoC3 */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C6615EE927582F13004CE48D /* AoC1 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C6615EEA27582F13004CE48D /* main.swift */,
|
||||
);
|
||||
path = AoC1;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C6615EF427583238004CE48D /* AoC2 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C6615EF527583238004CE48D /* main.swift */,
|
||||
);
|
||||
path = AoC2;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C6E4F9032759CCE4001C8B49 /* AoC3 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C6E4F9042759CCE4001C8B49 /* main.swift */,
|
||||
);
|
||||
path = AoC3;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
C6615EE727582F13004CE48D /* AoC1 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C6615EEC27582F13004CE48D /* Build configuration list for PBXNativeTarget "AoC1" */;
|
||||
buildPhases = (
|
||||
C6615EE427582F13004CE48D /* Sources */,
|
||||
C6615EE527582F13004CE48D /* Frameworks */,
|
||||
C6615EE627582F13004CE48D /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = AoC1;
|
||||
productName = AoC1;
|
||||
productReference = C6615EE827582F13004CE48D /* AoC1 */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
C6615EF227583238004CE48D /* AoC2 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C6615EF727583238004CE48D /* Build configuration list for PBXNativeTarget "AoC2" */;
|
||||
buildPhases = (
|
||||
C6615EEF27583238004CE48D /* Sources */,
|
||||
C6615EF027583238004CE48D /* Frameworks */,
|
||||
C6615EF127583238004CE48D /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = AoC2;
|
||||
productName = AoC2;
|
||||
productReference = C6615EF327583238004CE48D /* AoC2 */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
C6E4F9012759CCE4001C8B49 /* AoC3 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C6E4F9082759CCE4001C8B49 /* Build configuration list for PBXNativeTarget "AoC3" */;
|
||||
buildPhases = (
|
||||
C6E4F8FE2759CCE4001C8B49 /* Sources */,
|
||||
C6E4F8FF2759CCE4001C8B49 /* Frameworks */,
|
||||
C6E4F9002759CCE4001C8B49 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = AoC3;
|
||||
productName = AoC3;
|
||||
productReference = C6E4F9022759CCE4001C8B49 /* AoC3 */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
C6615ED027582D09004CE48D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
@@ -35,6 +185,17 @@
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1310;
|
||||
LastUpgradeCheck = 1310;
|
||||
TargetAttributes = {
|
||||
C6615EE727582F13004CE48D = {
|
||||
CreatedOnToolsVersion = 13.1;
|
||||
};
|
||||
C6615EF227583238004CE48D = {
|
||||
CreatedOnToolsVersion = 13.1;
|
||||
};
|
||||
C6E4F9012759CCE4001C8B49 = {
|
||||
CreatedOnToolsVersion = 13.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = C6615ED327582D09004CE48D /* Build configuration list for PBXProject "AoC" */;
|
||||
compatibilityVersion = "Xcode 13.0";
|
||||
@@ -49,10 +210,40 @@
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
C6615EE727582F13004CE48D /* AoC1 */,
|
||||
C6615EF227583238004CE48D /* AoC2 */,
|
||||
C6E4F9012759CCE4001C8B49 /* AoC3 */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
C6615EE427582F13004CE48D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C6615EEB27582F13004CE48D /* main.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C6615EEF27583238004CE48D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C6615EF627583238004CE48D /* main.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
C6E4F8FE2759CCE4001C8B49 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C6E4F9052759CCE4001C8B49 /* main.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
C6615EDD27582D09004CE48D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
@@ -169,6 +360,64 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C6615EED27582F13004CE48D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C6615EEE27582F13004CE48D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C6615EF827583238004CE48D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C6615EF927583238004CE48D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C6E4F9062759CCE4001C8B49 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C6E4F9072759CCE4001C8B49 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -181,6 +430,33 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C6615EEC27582F13004CE48D /* Build configuration list for PBXNativeTarget "AoC1" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C6615EED27582F13004CE48D /* Debug */,
|
||||
C6615EEE27582F13004CE48D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C6615EF727583238004CE48D /* Build configuration list for PBXNativeTarget "AoC2" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C6615EF827583238004CE48D /* Debug */,
|
||||
C6615EF927583238004CE48D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C6E4F9082759CCE4001C8B49 /* Build configuration list for PBXNativeTarget "AoC3" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C6E4F9062759CCE4001C8B49 /* Debug */,
|
||||
C6E4F9072759CCE4001C8B49 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = C6615ED027582D09004CE48D /* Project object */;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
89
AoC.xcodeproj/xcshareddata/xcschemes/AoC1.xcscheme
Normal file
89
AoC.xcodeproj/xcshareddata/xcschemes/AoC1.xcscheme
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1310"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6615EE727582F13004CE48D"
|
||||
BuildableName = "AoC1"
|
||||
BlueprintName = "AoC1"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "YES"
|
||||
customWorkingDirectory = "/Users/marijn/repos/AoC 2021"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6615EE727582F13004CE48D"
|
||||
BuildableName = "AoC1"
|
||||
BlueprintName = "AoC1"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "1.in"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<LocationScenarioReference
|
||||
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
|
||||
referenceType = "1">
|
||||
</LocationScenarioReference>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6615EE727582F13004CE48D"
|
||||
BuildableName = "AoC1"
|
||||
BlueprintName = "AoC1"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
89
AoC.xcodeproj/xcshareddata/xcschemes/AoC2.xcscheme
Normal file
89
AoC.xcodeproj/xcshareddata/xcschemes/AoC2.xcscheme
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1310"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6615EF227583238004CE48D"
|
||||
BuildableName = "AoC2"
|
||||
BlueprintName = "AoC2"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "YES"
|
||||
customWorkingDirectory = "/Users/marijn/repos/AoC 2021"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6615EF227583238004CE48D"
|
||||
BuildableName = "AoC2"
|
||||
BlueprintName = "AoC2"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "input2.in"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<LocationScenarioReference
|
||||
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
|
||||
referenceType = "1">
|
||||
</LocationScenarioReference>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6615EF227583238004CE48D"
|
||||
BuildableName = "AoC2"
|
||||
BlueprintName = "AoC2"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
85
AoC.xcodeproj/xcshareddata/xcschemes/AoC3.xcscheme
Normal file
85
AoC.xcodeproj/xcshareddata/xcschemes/AoC3.xcscheme
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1310"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6E4F9012759CCE4001C8B49"
|
||||
BuildableName = "AoC3"
|
||||
BlueprintName = "AoC3"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "YES"
|
||||
customWorkingDirectory = "/Users/marijn/repos/AoC 2021"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6E4F9012759CCE4001C8B49"
|
||||
BuildableName = "AoC3"
|
||||
BlueprintName = "AoC3"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "input3.in"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C6E4F9012759CCE4001C8B49"
|
||||
BuildableName = "AoC3"
|
||||
BlueprintName = "AoC3"
|
||||
ReferencedContainer = "container:AoC.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
40
AoC1/main.swift
Normal file
40
AoC1/main.swift
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// main.swift
|
||||
// AoC1
|
||||
//
|
||||
// Created by Marijn Doeve on 01-12-2021.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
var depths = [Int]()
|
||||
|
||||
let fileContent = try! String(contentsOfFile: CommandLine.arguments[1])
|
||||
for line in fileContent.components(separatedBy: .newlines) {
|
||||
if let line = Int(line) {
|
||||
depths.append(line)
|
||||
}
|
||||
}
|
||||
|
||||
var total = 0
|
||||
|
||||
for i in 1..<depths.count {
|
||||
if depths[i - 1] < depths[i] {
|
||||
total += 1
|
||||
}
|
||||
}
|
||||
|
||||
print("a:", total)
|
||||
|
||||
var prev = 1000000
|
||||
total = 0
|
||||
|
||||
for i in 1..<depths.count - 2 {
|
||||
let new = depths[i..<i + 3].reduce(0, +)
|
||||
|
||||
if new > prev {
|
||||
total += 1
|
||||
}
|
||||
prev = new
|
||||
}
|
||||
print("b:", total)
|
||||
56
AoC2/main.swift
Normal file
56
AoC2/main.swift
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// main.swift
|
||||
// AoC2
|
||||
//
|
||||
// Created by Marijn Doeve on 01-12-2021.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
var dept = 0
|
||||
var horizontalPosition = 0
|
||||
|
||||
let fileContent = try! String(contentsOfFile: CommandLine.arguments[1])
|
||||
for line in fileContent.trimmingCharacters(in: .newlines).components(separatedBy: .newlines) {
|
||||
let parts = line.components(separatedBy: " ")
|
||||
|
||||
let direction = parts[0]
|
||||
let number = Int(parts[1])!
|
||||
|
||||
switch direction {
|
||||
case "forward":
|
||||
horizontalPosition += number
|
||||
case "down":
|
||||
dept += number
|
||||
case "up":
|
||||
dept -= number
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
print("a:", horizontalPosition * dept)
|
||||
|
||||
var aim = 0
|
||||
var deptB = 0
|
||||
var horizontalPositionB = 0
|
||||
|
||||
|
||||
for line in fileContent.trimmingCharacters(in: .newlines).components(separatedBy: .newlines) {
|
||||
let parts = line.components(separatedBy: .whitespaces)
|
||||
|
||||
let direction = parts[0]
|
||||
let number = Int(parts[1])!
|
||||
|
||||
switch direction {
|
||||
case "up":
|
||||
aim -= number
|
||||
case "down":
|
||||
aim += number
|
||||
case "forward":
|
||||
horizontalPositionB += number
|
||||
deptB += aim * number
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
print("b:", horizontalPositionB * deptB)
|
||||
11
AoC3/main.swift
Normal file
11
AoC3/main.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// main.swift
|
||||
// AoC3
|
||||
//
|
||||
// Created by Marijn Doeve on 03-12-2021.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
print("Hello, World!")
|
||||
|
||||
Reference in New Issue
Block a user