parent
a9b76ca948
commit
ee24ad03b9
@ -0,0 +1,28 @@ |
||||
# Mac OS |
||||
|
||||
# General |
||||
.DS_Store |
||||
.AppleDouble |
||||
.LSOverride |
||||
|
||||
# Icon must end with two \r |
||||
Icon |
||||
|
||||
# Thumbnails |
||||
._* |
||||
|
||||
# Files that might appear in the root of a volume |
||||
.DocumentRevisions-V100 |
||||
.fseventsd |
||||
.Spotlight-V100 |
||||
.TemporaryItems |
||||
.Trashes |
||||
.VolumeIcon.icns |
||||
.com.apple.timemachine.donotpresent |
||||
|
||||
# Directories potentially created on remote AFP share |
||||
.AppleDB |
||||
.AppleDesktop |
||||
Network Trash Folder |
||||
Temporary Items |
||||
.apdisk |
@ -0,0 +1,66 @@ |
||||
# Xcode |
||||
|
||||
## User settings |
||||
xcuserdata/ |
||||
|
||||
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) |
||||
*.xcscmblueprint |
||||
*.xccheckout |
||||
|
||||
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) |
||||
build/ |
||||
DerivedData/ |
||||
*.moved-aside |
||||
*.pbxuser |
||||
!default.pbxuser |
||||
*.mode1v3 |
||||
!default.mode1v3 |
||||
*.mode2v3 |
||||
!default.mode2v3 |
||||
*.perspectivev3 |
||||
!default.perspectivev3 |
||||
|
||||
## Obj-C/Swift specific |
||||
*.hmap |
||||
|
||||
## App packaging |
||||
*.ipa |
||||
*.dSYM.zip |
||||
*.dSYM |
||||
|
||||
# CocoaPods |
||||
# |
||||
# We recommend against adding the Pods directory to your .gitignore. However |
||||
# you should judge for yourself, the pros and cons are mentioned at: |
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control |
||||
# |
||||
# Pods/ |
||||
# |
||||
# Add this line if you want to avoid checking in source code from the Xcode workspace |
||||
# *.xcworkspace |
||||
|
||||
# Carthage |
||||
# |
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies. |
||||
# Carthage/Checkouts |
||||
|
||||
Carthage/Build/ |
||||
|
||||
# fastlane |
||||
# |
||||
# It is recommended to not store the screenshots in the git repo. |
||||
# Instead, use fastlane to re-generate the screenshots whenever they are needed. |
||||
# For more information about the recommended setup visit: |
||||
# https://docs.fastlane.tools/best-practices/source-control/#source-control |
||||
|
||||
fastlane/report.xml |
||||
fastlane/Preview.html |
||||
fastlane/screenshots/**/*.png |
||||
fastlane/test_output |
||||
|
||||
# Code Injection |
||||
# |
||||
# After new code Injection tools there's a generated folder /iOSInjectionProject |
||||
# https://github.com/johnno1962/injectionforxcode |
||||
|
||||
iOSInjectionProject/ |
@ -0,0 +1,320 @@ |
||||
// !$*UTF8*$! |
||||
{ |
||||
archiveVersion = 1; |
||||
classes = { |
||||
}; |
||||
objectVersion = 55; |
||||
objects = { |
||||
|
||||
/* Begin PBXBuildFile section */ |
||||
239BBC5F293E512600B1482C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 239BBC5E293E512600B1482C /* main.m */; }; |
||||
239BBC6F293E59FE00B1482C /* ACCargoShip.m in Sources */ = {isa = PBXBuildFile; fileRef = 239BBC6E293E59FE00B1482C /* ACCargoShip.m */; }; |
||||
239BBC74293E8A0D00B1482C /* ACStack.m in Sources */ = {isa = PBXBuildFile; fileRef = 239BBC73293E8A0D00B1482C /* ACStack.m */; }; |
||||
239BBC78293E93BC00B1482C /* ACInstruction.m in Sources */ = {isa = PBXBuildFile; fileRef = 239BBC77293E93BC00B1482C /* ACInstruction.m */; }; |
||||
/* End PBXBuildFile section */ |
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */ |
||||
239BBC59293E512600B1482C /* CopyFiles */ = { |
||||
isa = PBXCopyFilesBuildPhase; |
||||
buildActionMask = 2147483647; |
||||
dstPath = /usr/share/man/man1/; |
||||
dstSubfolderSpec = 0; |
||||
files = ( |
||||
); |
||||
runOnlyForDeploymentPostprocessing = 1; |
||||
}; |
||||
/* End PBXCopyFilesBuildPhase section */ |
||||
|
||||
/* Begin PBXFileReference section */ |
||||
239BBC5B293E512600B1482C /* Day 5 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Day 5"; sourceTree = BUILT_PRODUCTS_DIR; }; |
||||
239BBC5E293E512600B1482C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; |
||||
239BBC6D293E59FE00B1482C /* ACCargoShip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ACCargoShip.h; sourceTree = "<group>"; }; |
||||
239BBC6E293E59FE00B1482C /* ACCargoShip.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ACCargoShip.m; sourceTree = "<group>"; }; |
||||
239BBC72293E8A0D00B1482C /* ACStack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ACStack.h; sourceTree = "<group>"; }; |
||||
239BBC73293E8A0D00B1482C /* ACStack.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ACStack.m; sourceTree = "<group>"; }; |
||||
239BBC76293E93BC00B1482C /* ACInstruction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ACInstruction.h; sourceTree = "<group>"; }; |
||||
239BBC77293E93BC00B1482C /* ACInstruction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ACInstruction.m; sourceTree = "<group>"; }; |
||||
/* End PBXFileReference section */ |
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */ |
||||
239BBC58293E512600B1482C /* Frameworks */ = { |
||||
isa = PBXFrameworksBuildPhase; |
||||
buildActionMask = 2147483647; |
||||
files = ( |
||||
); |
||||
runOnlyForDeploymentPostprocessing = 0; |
||||
}; |
||||
/* End PBXFrameworksBuildPhase section */ |
||||
|
||||
/* Begin PBXGroup section */ |
||||
239BBC52293E512600B1482C = { |
||||
isa = PBXGroup; |
||||
children = ( |
||||
239BBC5D293E512600B1482C /* Day 5 */, |
||||
239BBC5C293E512600B1482C /* Products */, |
||||
); |
||||
sourceTree = "<group>"; |
||||
}; |
||||
239BBC5C293E512600B1482C /* Products */ = { |
||||
isa = PBXGroup; |
||||
children = ( |
||||
239BBC5B293E512600B1482C /* Day 5 */, |
||||
); |
||||
name = Products; |
||||
sourceTree = "<group>"; |
||||
}; |
||||
239BBC5D293E512600B1482C /* Day 5 */ = { |
||||
isa = PBXGroup; |
||||
children = ( |
||||
239BBC6C293E59DE00B1482C /* ACCargoShip */, |
||||
239BBC75293E93AB00B1482C /* ACInstruction */, |
||||
239BBC70293E89EC00B1482C /* ACStack */, |
||||
239BBC5E293E512600B1482C /* main.m */, |
||||
); |
||||
path = "Day 5"; |
||||
sourceTree = "<group>"; |
||||
}; |
||||
239BBC6C293E59DE00B1482C /* ACCargoShip */ = { |
||||
isa = PBXGroup; |
||||
children = ( |
||||
239BBC6D293E59FE00B1482C /* ACCargoShip.h */, |
||||
239BBC6E293E59FE00B1482C /* ACCargoShip.m */, |
||||
); |
||||
path = ACCargoShip; |
||||
sourceTree = "<group>"; |
||||
}; |
||||
239BBC70293E89EC00B1482C /* ACStack */ = { |
||||
isa = PBXGroup; |
||||
children = ( |
||||
239BBC72293E8A0D00B1482C /* ACStack.h */, |
||||
239BBC73293E8A0D00B1482C /* ACStack.m */, |
||||
); |
||||
path = ACStack; |
||||
sourceTree = "<group>"; |
||||
}; |
||||
239BBC75293E93AB00B1482C /* ACInstruction */ = { |
||||
isa = PBXGroup; |
||||
children = ( |
||||
239BBC76293E93BC00B1482C /* ACInstruction.h */, |
||||
239BBC77293E93BC00B1482C /* ACInstruction.m */, |
||||
); |
||||
path = ACInstruction; |
||||
sourceTree = "<group>"; |
||||
}; |
||||
/* End PBXGroup section */ |
||||
|
||||
/* Begin PBXNativeTarget section */ |
||||
239BBC5A293E512600B1482C /* Day 5 */ = { |
||||
isa = PBXNativeTarget; |
||||
buildConfigurationList = 239BBC62293E512600B1482C /* Build configuration list for PBXNativeTarget "Day 5" */; |
||||
buildPhases = ( |
||||
239BBC57293E512600B1482C /* Sources */, |
||||
239BBC58293E512600B1482C /* Frameworks */, |
||||
239BBC59293E512600B1482C /* CopyFiles */, |
||||
); |
||||
buildRules = ( |
||||
); |
||||
dependencies = ( |
||||
); |
||||
name = "Day 5"; |
||||
productName = "Day 5"; |
||||
productReference = 239BBC5B293E512600B1482C /* Day 5 */; |
||||
productType = "com.apple.product-type.tool"; |
||||
}; |
||||
/* End PBXNativeTarget section */ |
||||
|
||||
/* Begin PBXProject section */ |
||||
239BBC53293E512600B1482C /* Project object */ = { |
||||
isa = PBXProject; |
||||
attributes = { |
||||
BuildIndependentTargetsInParallel = 1; |
||||
LastUpgradeCheck = 1340; |
||||
TargetAttributes = { |
||||
239BBC5A293E512600B1482C = { |
||||
CreatedOnToolsVersion = 13.4; |
||||
}; |
||||
}; |
||||
}; |
||||
buildConfigurationList = 239BBC56293E512600B1482C /* Build configuration list for PBXProject "Day 5" */; |
||||
compatibilityVersion = "Xcode 13.0"; |
||||
developmentRegion = en; |
||||
hasScannedForEncodings = 0; |
||||
knownRegions = ( |
||||
en, |
||||
Base, |
||||
); |
||||
mainGroup = 239BBC52293E512600B1482C; |
||||
productRefGroup = 239BBC5C293E512600B1482C /* Products */; |
||||
projectDirPath = ""; |
||||
projectRoot = ""; |
||||
targets = ( |
||||
239BBC5A293E512600B1482C /* Day 5 */, |
||||
); |
||||
}; |
||||
/* End PBXProject section */ |
||||
|
||||
/* Begin PBXSourcesBuildPhase section */ |
||||
239BBC57293E512600B1482C /* Sources */ = { |
||||
isa = PBXSourcesBuildPhase; |
||||
buildActionMask = 2147483647; |
||||
files = ( |
||||
239BBC78293E93BC00B1482C /* ACInstruction.m in Sources */, |
||||
239BBC6F293E59FE00B1482C /* ACCargoShip.m in Sources */, |
||||
239BBC74293E8A0D00B1482C /* ACStack.m in Sources */, |
||||
239BBC5F293E512600B1482C /* main.m in Sources */, |
||||
); |
||||
runOnlyForDeploymentPostprocessing = 0; |
||||
}; |
||||
/* End PBXSourcesBuildPhase section */ |
||||
|
||||
/* Begin XCBuildConfiguration section */ |
||||
239BBC60293E512600B1482C /* Debug */ = { |
||||
isa = XCBuildConfiguration; |
||||
buildSettings = { |
||||
ALWAYS_SEARCH_USER_PATHS = NO; |
||||
CLANG_ANALYZER_NONNULL = YES; |
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; |
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; |
||||
CLANG_ENABLE_MODULES = YES; |
||||
CLANG_ENABLE_OBJC_ARC = YES; |
||||
CLANG_ENABLE_OBJC_WEAK = YES; |
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; |
||||
CLANG_WARN_BOOL_CONVERSION = YES; |
||||
CLANG_WARN_COMMA = YES; |
||||
CLANG_WARN_CONSTANT_CONVERSION = YES; |
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; |
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; |
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; |
||||
CLANG_WARN_EMPTY_BODY = YES; |
||||
CLANG_WARN_ENUM_CONVERSION = YES; |
||||
CLANG_WARN_INFINITE_RECURSION = YES; |
||||
CLANG_WARN_INT_CONVERSION = YES; |
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; |
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; |
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; |
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; |
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; |
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; |
||||
CLANG_WARN_STRICT_PROTOTYPES = YES; |
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES; |
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; |
||||
CLANG_WARN_UNREACHABLE_CODE = YES; |
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; |
||||
COPY_PHASE_STRIP = NO; |
||||
DEBUG_INFORMATION_FORMAT = dwarf; |
||||
ENABLE_STRICT_OBJC_MSGSEND = YES; |
||||
ENABLE_TESTABILITY = YES; |
||||
GCC_C_LANGUAGE_STANDARD = gnu11; |
||||
GCC_DYNAMIC_NO_PIC = NO; |
||||
GCC_NO_COMMON_BLOCKS = YES; |
||||
GCC_OPTIMIZATION_LEVEL = 0; |
||||
GCC_PREPROCESSOR_DEFINITIONS = ( |
||||
"DEBUG=1", |
||||
"$(inherited)", |
||||
); |
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; |
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; |
||||
GCC_WARN_UNDECLARED_SELECTOR = YES; |
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
||||
GCC_WARN_UNUSED_FUNCTION = YES; |
||||
GCC_WARN_UNUSED_VARIABLE = YES; |
||||
MACOSX_DEPLOYMENT_TARGET = 12.3; |
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; |
||||
MTL_FAST_MATH = YES; |
||||
ONLY_ACTIVE_ARCH = YES; |
||||
SDKROOT = macosx; |
||||
}; |
||||
name = Debug; |
||||
}; |
||||
239BBC61293E512600B1482C /* Release */ = { |
||||
isa = XCBuildConfiguration; |
||||
buildSettings = { |
||||
ALWAYS_SEARCH_USER_PATHS = NO; |
||||
CLANG_ANALYZER_NONNULL = YES; |
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; |
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; |
||||
CLANG_ENABLE_MODULES = YES; |
||||
CLANG_ENABLE_OBJC_ARC = YES; |
||||
CLANG_ENABLE_OBJC_WEAK = YES; |
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; |
||||
CLANG_WARN_BOOL_CONVERSION = YES; |
||||
CLANG_WARN_COMMA = YES; |
||||
CLANG_WARN_CONSTANT_CONVERSION = YES; |
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; |
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; |
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; |
||||
CLANG_WARN_EMPTY_BODY = YES; |
||||
CLANG_WARN_ENUM_CONVERSION = YES; |
||||
CLANG_WARN_INFINITE_RECURSION = YES; |
||||
CLANG_WARN_INT_CONVERSION = YES; |
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; |
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; |
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; |
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; |
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; |
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; |
||||
CLANG_WARN_STRICT_PROTOTYPES = YES; |
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES; |
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; |
||||
CLANG_WARN_UNREACHABLE_CODE = YES; |
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; |
||||
COPY_PHASE_STRIP = NO; |
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; |
||||
ENABLE_NS_ASSERTIONS = NO; |
||||
ENABLE_STRICT_OBJC_MSGSEND = YES; |
||||
GCC_C_LANGUAGE_STANDARD = gnu11; |
||||
GCC_NO_COMMON_BLOCKS = YES; |
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; |
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; |
||||
GCC_WARN_UNDECLARED_SELECTOR = YES; |
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
||||
GCC_WARN_UNUSED_FUNCTION = YES; |
||||
GCC_WARN_UNUSED_VARIABLE = YES; |
||||
MACOSX_DEPLOYMENT_TARGET = 12.3; |
||||
MTL_ENABLE_DEBUG_INFO = NO; |
||||
MTL_FAST_MATH = YES; |
||||
SDKROOT = macosx; |
||||
}; |
||||
name = Release; |
||||
}; |
||||
239BBC63293E512600B1482C /* Debug */ = { |
||||
isa = XCBuildConfiguration; |
||||
buildSettings = { |
||||
CODE_SIGN_STYLE = Automatic; |
||||
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
}; |
||||
name = Debug; |
||||
}; |
||||
239BBC64293E512600B1482C /* Release */ = { |
||||
isa = XCBuildConfiguration; |
||||
buildSettings = { |
||||
CODE_SIGN_STYLE = Automatic; |
||||
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
}; |
||||
name = Release; |
||||
}; |
||||
/* End XCBuildConfiguration section */ |
||||
|
||||
/* Begin XCConfigurationList section */ |
||||
239BBC56293E512600B1482C /* Build configuration list for PBXProject "Day 5" */ = { |
||||
isa = XCConfigurationList; |
||||
buildConfigurations = ( |
||||
239BBC60293E512600B1482C /* Debug */, |
||||
239BBC61293E512600B1482C /* Release */, |
||||
); |
||||
defaultConfigurationIsVisible = 0; |
||||
defaultConfigurationName = Release; |
||||
}; |
||||
239BBC62293E512600B1482C /* Build configuration list for PBXNativeTarget "Day 5" */ = { |
||||
isa = XCConfigurationList; |
||||
buildConfigurations = ( |
||||
239BBC63293E512600B1482C /* Debug */, |
||||
239BBC64293E512600B1482C /* Release */, |
||||
); |
||||
defaultConfigurationIsVisible = 0; |
||||
defaultConfigurationName = Release; |
||||
}; |
||||
/* End XCConfigurationList section */ |
||||
}; |
||||
rootObject = 239BBC53293E512600B1482C /* Project object */; |
||||
} |
@ -0,0 +1,7 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<Workspace |
||||
version = "1.0"> |
||||
<FileRef |
||||
location = "self:"> |
||||
</FileRef> |
||||
</Workspace> |
@ -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>IDEDidComputeMac32BitWarning</key> |
||||
<true/> |
||||
</dict> |
||||
</plist> |
@ -0,0 +1,20 @@ |
||||
#import <Foundation/Foundation.h> |
||||
#import "../ACStack/ACStack.h" |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
@interface ACCargoShip : NSObject <NSCopying> |
||||
|
||||
- (nullable instancetype)initWithInputLines:(NSArray *)inputLines; |
||||
|
||||
- (NSString *)description; |
||||
|
||||
- (ACStack *)getStack:(NSUInteger)index; |
||||
- (NSString *)getTopCrateMarkings; |
||||
- (NSUInteger)getLargestStackHeight; |
||||
|
||||
@property (nonatomic) NSUInteger numberOfStacks; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,95 @@ |
||||
#import "ACCargoShip.h" |
||||
|
||||
@interface ACCargoShip () |
||||
|
||||
@property (nonatomic, strong) NSMutableArray<ACStack *> * stacks; |
||||
|
||||
@end |
||||
|
||||
@implementation ACCargoShip |
||||
|
||||
@synthesize stacks; |
||||
|
||||
- (nullable instancetype)initWithInputLines:(NSArray *)inputLines { |
||||
self = [super init]; |
||||
if (self) { |
||||
NSInteger cargoStackStartIndex = 0; |
||||
|
||||
// Initialize the stacks |
||||
for (NSString * inputLine in inputLines) { |
||||
if (![inputLine hasPrefix:@" 1 "]) { |
||||
cargoStackStartIndex++; |
||||
continue; |
||||
} |
||||
|
||||
NSArray * stackNumber = [inputLine componentsSeparatedByString:@" "]; |
||||
self.numberOfStacks = [[stackNumber lastObject] integerValue]; |
||||
|
||||
break; |
||||
} |
||||
|
||||
// Populate the stacks |
||||
self.stacks = [NSMutableArray arrayWithCapacity:self.numberOfStacks]; |
||||
for (NSInteger stackIndex = 0; stackIndex < self.numberOfStacks; stackIndex++) { |
||||
[self.stacks addObject:[[ACStack alloc] initWithCapacity:cargoStackStartIndex - 1]]; |
||||
|
||||
for (NSInteger lineIndex = 0; lineIndex < cargoStackStartIndex; lineIndex++) { |
||||
NSString * crates = [inputLines objectAtIndex:lineIndex]; |
||||
|
||||
NSString * crate = [crates substringWithRange:NSMakeRange(stackIndex * 3 + stackIndex, 3)]; |
||||
if ([crate isEqualToString:@" "]) { |
||||
continue; |
||||
} |
||||
|
||||
NSString * marking = [crate substringWithRange:NSMakeRange(1, 1)]; |
||||
[[self.stacks objectAtIndex:stackIndex] populateStackWithCrate:marking]; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return self; |
||||
} |
||||
|
||||
- (id)copyWithZone:(NSZone *)zone { |
||||
ACCargoShip * copy = [[ACCargoShip allocWithZone:zone] init]; |
||||
copy.stacks = [self.stacks copy]; |
||||
|
||||
return copy; |
||||
} |
||||
|
||||
- (NSString *)description { |
||||
NSMutableString * description = [NSMutableString stringWithString:@"{\n"]; |
||||
NSUInteger cargoIndex = 0; |
||||
for (ACStack * stack in self.stacks) { |
||||
[description appendFormat:@"\t%d: %@,\n", (unsigned int) cargoIndex, [stack description]]; |
||||
cargoIndex++; |
||||
} |
||||
[description appendString:@"}"]; |
||||
return description; |
||||
} |
||||
|
||||
- (ACStack *)getStack:(NSUInteger)index { |
||||
return [self.stacks objectAtIndex:index]; |
||||
} |
||||
|
||||
- (NSString *)getTopCrateMarkings { |
||||
NSMutableString * topCrates = [NSMutableString string]; |
||||
for (ACStack * stack in self.stacks) { |
||||
[topCrates appendString:[stack getTopCrateMarking]]; |
||||
} |
||||
|
||||
return topCrates; |
||||
} |
||||
|
||||
- (NSUInteger)getLargestStackHeight { |
||||
NSUInteger stackHeight = 0; |
||||
for (ACStack * stack in self.stacks) { |
||||
if (stackHeight < [stack getHeight]) { |
||||
stackHeight = [stack getHeight]; |
||||
} |
||||
} |
||||
|
||||
return stackHeight; |
||||
} |
||||
|
||||
@end |
@ -0,0 +1,18 @@ |
||||
#import <Foundation/Foundation.h> |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
@interface ACInstruction : NSObject |
||||
|
||||
- (nullable instancetype)initWithString:(NSString *)instruction; |
||||
|
||||
- (NSString *)description; |
||||
|
||||
@property (nonatomic) NSUInteger fromStackIndex; |
||||
@property (nonatomic) NSUInteger toStackIndex; |
||||
|
||||
@property (nonatomic) NSUInteger numberOfCargo; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,22 @@ |
||||
#import "ACInstruction.h" |
||||
|
||||
@implementation ACInstruction |
||||
|
||||
- (nullable instancetype)initWithString:(NSString *)instruction { |
||||
self = [super init]; |
||||
if (self) { |
||||
NSArray * components = [instruction componentsSeparatedByString:@" "]; |
||||
|
||||
self.numberOfCargo = [[components objectAtIndex:1] integerValue]; |
||||
self.fromStackIndex = [[components objectAtIndex:3] integerValue] - 1; |
||||
self.toStackIndex = [[components objectAtIndex:5] integerValue] - 1; |
||||
} |
||||
|
||||
return self; |
||||
} |
||||
|
||||
- (NSString *)description { |
||||
return [NSString stringWithFormat:@"move %d from %d to %d", (int) self.numberOfCargo, (int) self.fromStackIndex, (int) self.toStackIndex]; |
||||
} |
||||
|
||||
@end |
@ -0,0 +1,20 @@ |
||||
#import <Foundation/Foundation.h> |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
@interface ACStack : NSObject |
||||
|
||||
- (nullable instancetype)initWithCapacity:(NSInteger)capacity; |
||||
|
||||
- (NSString *)description; |
||||
|
||||
- (void)populateStackWithCrate:(NSString *)crate; |
||||
- (void)addCrate:(NSString *)crate; |
||||
|
||||
- (NSString *)getCrate; |
||||
- (NSString *)getTopCrateMarking; |
||||
- (NSUInteger)getHeight; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,49 @@ |
||||
#import "ACStack.h" |
||||
|
||||
@interface ACStack () |
||||
|
||||
@property (nonatomic, strong) NSMutableArray<NSString *> * cargo; |
||||
|
||||
@end |
||||
|
||||
@implementation ACStack |
||||
|
||||
@synthesize cargo; |
||||
|
||||
- (nullable instancetype)initWithCapacity:(NSInteger)capacity { |
||||
self = [super init]; |
||||
if (self) { |
||||
self.cargo = [NSMutableArray arrayWithCapacity:capacity]; |
||||
} |
||||
|
||||
return self; |
||||
} |
||||
|
||||
- (NSString *)description { |
||||
return [NSString stringWithFormat:@"['%@']", [self.cargo componentsJoinedByString:@"','"]]; |
||||
} |
||||
|
||||
- (void)populateStackWithCrate:(NSString *)crate { |
||||
[self.cargo addObject:crate]; |
||||
} |
||||
|
||||
- (void)addCrate:(NSString *)crate { |
||||
[self.cargo insertObject:crate atIndex:0]; |
||||
} |
||||
|
||||
- (NSString *)getCrate { |
||||
NSString * crate = [self.cargo firstObject]; |
||||
[self.cargo removeObjectAtIndex:0]; |
||||
|
||||
return crate; |
||||
} |
||||
|
||||
- (NSString *)getTopCrateMarking { |
||||
return [self.cargo firstObject]; |
||||
} |
||||
|
||||
- (NSUInteger)getHeight { |
||||
return self.cargo.count; |
||||
} |
||||
|
||||
@end |
@ -0,0 +1,78 @@ |
||||
#import <Foundation/Foundation.h> |
||||
#import "ACCargoShip/ACCargoShip.h" |
||||
#import "ACInstruction/ACInstruction.h" |
||||
#import "ACStack/ACStack.h" |
||||
|
||||
void partOne(ACCargoShip * cargoShip, NSArray * instructions) { |
||||
for (ACInstruction * instruction in instructions) { |
||||
ACStack * fromStack = [cargoShip getStack:instruction.fromStackIndex]; |
||||
ACStack * toStack = [cargoShip getStack:instruction.toStackIndex]; |
||||
|
||||
for (NSInteger i = 0; i < instruction.numberOfCargo; i++) { |
||||
[toStack addCrate:[fromStack getCrate]]; |
||||
} |
||||
} |
||||
|
||||
NSLog(@"Part 1: %@", [cargoShip getTopCrateMarkings]); |
||||
} |
||||
|
||||
void partTwo(ACCargoShip * cargoShip, NSArray * instructions) { |
||||
for (ACInstruction * instruction in instructions) { |
||||
ACStack * fromStack = [cargoShip getStack:instruction.fromStackIndex]; |
||||
ACStack * toStack = [cargoShip getStack:instruction.toStackIndex]; |
||||
|
||||
NSMutableArray<NSString *> * crates = [NSMutableArray arrayWithCapacity:instruction.numberOfCargo]; |
||||
for (NSInteger i = 0; i < instruction.numberOfCargo; i++) { |
||||
[crates addObject:[fromStack getCrate]]; |
||||
} |
||||
|
||||
for (NSString * crate in [crates reverseObjectEnumerator]) { |
||||
[toStack addCrate:crate]; |
||||
} |
||||
} |
||||
|
||||
NSLog(@"Part 2: %@", [cargoShip getTopCrateMarkings]); |
||||
} |
||||
|
||||
int main(int argc, const char * argv[]) { |
||||
@autoreleasepool { |
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:@"./input"]) { |
||||
NSLog(@"Input file does not exists"); |
||||
return 1; |
||||
} |
||||
|
||||
NSError * error; |
||||
NSString * input = [NSString stringWithContentsOfFile:@"./input" encoding:NSASCIIStringEncoding error:&error]; |
||||
if (error) { |
||||
NSLog(@"Error opening file: %@", error.localizedDescription); |
||||
return 1; |
||||
} |
||||
|
||||
NSArray * inputLines = [input componentsSeparatedByString:@"\n"]; |
||||
|
||||
ACCargoShip * cargoShip = [[ACCargoShip alloc] initWithInputLines:inputLines]; |
||||
|
||||
// Parse Instructions |
||||
NSMutableArray * instructions = [NSMutableArray arrayWithCapacity:[inputLines count] - ([cargoShip getLargestStackHeight] + 2)]; |
||||
bool foundInstructions = false; |
||||
for (NSString * inputLine in inputLines) { |
||||
if (!foundInstructions) { |
||||
foundInstructions = [inputLine isEqualToString:@""]; |
||||
continue; |
||||
} |
||||
|
||||
if ([inputLine isEqualToString:@""]) { |
||||
continue; |
||||
} |
||||
|
||||
[instructions addObject:[[ACInstruction alloc] initWithString:inputLine]]; |
||||
} |
||||
|
||||
partOne(cargoShip, instructions); |
||||
|
||||
cargoShip = [[ACCargoShip alloc] initWithInputLines:inputLines]; |
||||
partTwo(cargoShip, instructions); |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,126 @@ |
||||
# Day 5: Supply Stacks |
||||
|
||||
The expedition can depart as soon as the final supplies have been unloaded from the ships. Supplies are stored in stacks of marked **crates**, but because the needed supplies are buried under many other crates, the crates need to be rearranged. |
||||
|
||||
The ship has a **giant cargo crane** capable of moving crates between stacks. To ensure none of the crates get crushed or fall over, the crane operator will rearrange them in a series of carefully-planned steps. After the crates are rearranged, the desired crates will be at the top of each stack. |
||||
|
||||
The Elves don't want to interrupt the crane operator during this delicate procedure, but they forgot to ask her **which** crate will end up where, and they want to be ready to unload them as soon as possible so they can embark. |
||||
|
||||
They do, however, have a drawing of the starting stacks of crates **and** the rearrangement procedure (your puzzle input). For example: |
||||
|
||||
``` |
||||
[D] |
||||
[N] [C] |
||||
[Z] [M] [P] |
||||
1 2 3 |
||||
|
||||
move 1 from 2 to 1 |
||||
move 3 from 1 to 3 |
||||
move 2 from 2 to 1 |
||||
move 1 from 1 to 2 |
||||
``` |
||||
|
||||
In this example, there are three stacks of crates. Stack 1 contains two crates: crate `Z` is on the bottom, and crate `N` is on top. Stack 2 contains three crates; from bottom to top, they are crates `M`, `C`, and `D`. Finally, stack 3 contains a single crate, `P`. |
||||
|
||||
Then, the rearrangement procedure is given. In each step of the procedure, a quantity of crates is moved from one stack to a different stack. In the first step of the above rearrangement procedure, one crate is moved from stack 2 to stack 1, resulting in this configuration: |
||||
|
||||
``` |
||||
[D] |
||||
[N] [C] |
||||
[Z] [M] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
In the second step, three crates are moved from stack 1 to stack 3. Crates are moved **one at a time**, so the first crate to be moved (`D`) ends up below the second and third crates: |
||||
|
||||
``` |
||||
[Z] |
||||
[N] |
||||
[C] [D] |
||||
[M] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
Then, both crates are moved from stack 2 to stack 1. Again, because crates are moved **one at a time**, crate `C` ends up below crate `M`: |
||||
|
||||
``` |
||||
[Z] |
||||
[N] |
||||
[M] [D] |
||||
[C] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
Finally, one crate is moved from stack 1 to stack 2: |
||||
|
||||
``` |
||||
[Z] |
||||
[N] |
||||
[D] |
||||
[C] [M] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
The Elves just need to know **which crate will end up on top of each stack**; in this example, the top crates are `C` in stack 1, `M` in stack 2, and `Z` in stack 3, so you should combine these together and give the Elves the message `CMZ`. |
||||
|
||||
**After the rearrangement procedure completes, what crate ends up on top of each stack?** |
||||
|
||||
# Part Two |
||||
|
||||
As you watch the crane operator expertly rearrange the crates, you notice the process isn't following your prediction. |
||||
|
||||
Some mud was covering the writing on the side of the crane, and you quickly wipe it away. The crane isn't a CrateMover 9000 - it's a **CrateMover 9001**. |
||||
|
||||
The CrateMover 9001 is notable for many new and exciting features: air conditioning, leather seats, an extra cup holder, and **the ability to pick up and move multiple crates at once**. |
||||
|
||||
Again considering the example above, the crates begin in the same configuration: |
||||
|
||||
``` |
||||
[D] |
||||
[N] [C] |
||||
[Z] [M] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
Moving a single crate from stack 2 to stack 1 behaves the same as before: |
||||
|
||||
``` |
||||
[D] |
||||
[N] [C] |
||||
[Z] [M] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
However, the action of moving three crates from stack 1 to stack 3 means that those three moved crates **stay in the same order**, resulting in this new configuration: |
||||
|
||||
``` |
||||
[D] |
||||
[N] |
||||
[C] [Z] |
||||
[M] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
Next, as both crates are moved from stack 2 to stack 1, they **retain their order** as well: |
||||
|
||||
``` |
||||
[D] |
||||
[N] |
||||
[C] [Z] |
||||
[M] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
Finally, a single crate is still moved from stack 1 to stack 2, but now it's crate `C` that gets moved: |
||||
|
||||
``` |
||||
[D] |
||||
[N] |
||||
[Z] |
||||
[M] [C] [P] |
||||
1 2 3 |
||||
``` |
||||
|
||||
In this example, the CrateMover 9001 has put the crates in a totally different order: `MCD`. |
||||
|
||||
Before the rearrangement process finishes, update your simulation so that the Elves know where they should stand to be ready to unload the final supplies. **After the rearrangement procedure completes, what crate ends up on top of each stack?** |
@ -0,0 +1,512 @@ |
||||
[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 |
@ -0,0 +1,9 @@ |
||||
# Advent of Code 2022 Solutions |
||||
|
||||
This year I've decided to do each day in a different language: |
||||
|
||||
- [Day 1](https://git.nicholemattera.com/NicholeMattera/AOC-2022-Solutions/src/branch/main/Day%201) - [Javascript](https://en.wikipedia.org/wiki/JavaScript) |
||||
- [Day 2](https://git.nicholemattera.com/NicholeMattera/AOC-2022-Solutions/src/branch/main/Day%202) - [Rust](https://en.wikipedia.org/wiki/Rust_(programming_language)) |
||||
- [Day 3](https://git.nicholemattera.com/NicholeMattera/AOC-2022-Solutions/src/branch/main/Day%203) - [C](https://en.wikipedia.org/wiki/C_(programming_language)) |
||||
- [Day 4](https://git.nicholemattera.com/NicholeMattera/AOC-2022-Solutions/src/branch/main/Day%204) - [Spreadsheet (LibreOffice Calc)](https://en.wikipedia.org/wiki/Spreadsheet) |
||||
- [Day 5](https://git.nicholemattera.com/NicholeMattera/AOC-2022-Solutions/src/branch/main/Day%204) - [Objective-C](https://en.wikipedia.org/wiki/Objective-C) |
Loading…
Reference in new issue