Skip to content

Commit 38a0f73

Browse files
committed
Day 10: Elves Look, Elves Say
1 parent 77aecad commit 38a0f73

File tree

4 files changed

+346
-0
lines changed

4 files changed

+346
-0
lines changed

day10/day10.xcodeproj/project.pbxproj

Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 50;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
06C3540421DDC381001D911D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C3540321DDC381001D911D /* main.swift */; };
11+
/* End PBXBuildFile section */
12+
13+
/* Begin PBXCopyFilesBuildPhase section */
14+
06C353FE21DDC381001D911D /* CopyFiles */ = {
15+
isa = PBXCopyFilesBuildPhase;
16+
buildActionMask = 2147483647;
17+
dstPath = /usr/share/man/man1/;
18+
dstSubfolderSpec = 0;
19+
files = (
20+
);
21+
runOnlyForDeploymentPostprocessing = 1;
22+
};
23+
/* End PBXCopyFilesBuildPhase section */
24+
25+
/* Begin PBXFileReference section */
26+
06C3540021DDC381001D911D /* day10 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = day10; sourceTree = BUILT_PRODUCTS_DIR; };
27+
06C3540321DDC381001D911D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
28+
/* End PBXFileReference section */
29+
30+
/* Begin PBXFrameworksBuildPhase section */
31+
06C353FD21DDC381001D911D /* Frameworks */ = {
32+
isa = PBXFrameworksBuildPhase;
33+
buildActionMask = 2147483647;
34+
files = (
35+
);
36+
runOnlyForDeploymentPostprocessing = 0;
37+
};
38+
/* End PBXFrameworksBuildPhase section */
39+
40+
/* Begin PBXGroup section */
41+
06C353F721DDC381001D911D = {
42+
isa = PBXGroup;
43+
children = (
44+
06C3540221DDC381001D911D /* day10 */,
45+
06C3540121DDC381001D911D /* Products */,
46+
);
47+
sourceTree = "<group>";
48+
};
49+
06C3540121DDC381001D911D /* Products */ = {
50+
isa = PBXGroup;
51+
children = (
52+
06C3540021DDC381001D911D /* day10 */,
53+
);
54+
name = Products;
55+
sourceTree = "<group>";
56+
};
57+
06C3540221DDC381001D911D /* day10 */ = {
58+
isa = PBXGroup;
59+
children = (
60+
06C3540321DDC381001D911D /* main.swift */,
61+
);
62+
path = day10;
63+
sourceTree = "<group>";
64+
};
65+
/* End PBXGroup section */
66+
67+
/* Begin PBXNativeTarget section */
68+
06C353FF21DDC381001D911D /* day10 */ = {
69+
isa = PBXNativeTarget;
70+
buildConfigurationList = 06C3540721DDC381001D911D /* Build configuration list for PBXNativeTarget "day10" */;
71+
buildPhases = (
72+
06C353FC21DDC381001D911D /* Sources */,
73+
06C353FD21DDC381001D911D /* Frameworks */,
74+
06C353FE21DDC381001D911D /* CopyFiles */,
75+
);
76+
buildRules = (
77+
);
78+
dependencies = (
79+
);
80+
name = day10;
81+
productName = day10;
82+
productReference = 06C3540021DDC381001D911D /* day10 */;
83+
productType = "com.apple.product-type.tool";
84+
};
85+
/* End PBXNativeTarget section */
86+
87+
/* Begin PBXProject section */
88+
06C353F821DDC381001D911D /* Project object */ = {
89+
isa = PBXProject;
90+
attributes = {
91+
LastSwiftUpdateCheck = 1010;
92+
LastUpgradeCheck = 1010;
93+
ORGANIZATIONNAME = "Tyler Kieft";
94+
TargetAttributes = {
95+
06C353FF21DDC381001D911D = {
96+
CreatedOnToolsVersion = 10.1;
97+
};
98+
};
99+
};
100+
buildConfigurationList = 06C353FB21DDC381001D911D /* Build configuration list for PBXProject "day10" */;
101+
compatibilityVersion = "Xcode 9.3";
102+
developmentRegion = en;
103+
hasScannedForEncodings = 0;
104+
knownRegions = (
105+
en,
106+
);
107+
mainGroup = 06C353F721DDC381001D911D;
108+
productRefGroup = 06C3540121DDC381001D911D /* Products */;
109+
projectDirPath = "";
110+
projectRoot = "";
111+
targets = (
112+
06C353FF21DDC381001D911D /* day10 */,
113+
);
114+
};
115+
/* End PBXProject section */
116+
117+
/* Begin PBXSourcesBuildPhase section */
118+
06C353FC21DDC381001D911D /* Sources */ = {
119+
isa = PBXSourcesBuildPhase;
120+
buildActionMask = 2147483647;
121+
files = (
122+
06C3540421DDC381001D911D /* main.swift in Sources */,
123+
);
124+
runOnlyForDeploymentPostprocessing = 0;
125+
};
126+
/* End PBXSourcesBuildPhase section */
127+
128+
/* Begin XCBuildConfiguration section */
129+
06C3540521DDC381001D911D /* Debug */ = {
130+
isa = XCBuildConfiguration;
131+
buildSettings = {
132+
ALWAYS_SEARCH_USER_PATHS = NO;
133+
CLANG_ANALYZER_NONNULL = YES;
134+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
135+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
136+
CLANG_CXX_LIBRARY = "libc++";
137+
CLANG_ENABLE_MODULES = YES;
138+
CLANG_ENABLE_OBJC_ARC = YES;
139+
CLANG_ENABLE_OBJC_WEAK = YES;
140+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
141+
CLANG_WARN_BOOL_CONVERSION = YES;
142+
CLANG_WARN_COMMA = YES;
143+
CLANG_WARN_CONSTANT_CONVERSION = YES;
144+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
145+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
146+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
147+
CLANG_WARN_EMPTY_BODY = YES;
148+
CLANG_WARN_ENUM_CONVERSION = YES;
149+
CLANG_WARN_INFINITE_RECURSION = YES;
150+
CLANG_WARN_INT_CONVERSION = YES;
151+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
152+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
153+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
154+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
155+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
156+
CLANG_WARN_STRICT_PROTOTYPES = YES;
157+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
158+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
159+
CLANG_WARN_UNREACHABLE_CODE = YES;
160+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
161+
CODE_SIGN_IDENTITY = "-";
162+
COPY_PHASE_STRIP = NO;
163+
DEBUG_INFORMATION_FORMAT = dwarf;
164+
ENABLE_STRICT_OBJC_MSGSEND = YES;
165+
ENABLE_TESTABILITY = YES;
166+
GCC_C_LANGUAGE_STANDARD = gnu11;
167+
GCC_DYNAMIC_NO_PIC = NO;
168+
GCC_NO_COMMON_BLOCKS = YES;
169+
GCC_OPTIMIZATION_LEVEL = 0;
170+
GCC_PREPROCESSOR_DEFINITIONS = (
171+
"DEBUG=1",
172+
"$(inherited)",
173+
);
174+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
175+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
176+
GCC_WARN_UNDECLARED_SELECTOR = YES;
177+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
178+
GCC_WARN_UNUSED_FUNCTION = YES;
179+
GCC_WARN_UNUSED_VARIABLE = YES;
180+
MACOSX_DEPLOYMENT_TARGET = 10.14;
181+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
182+
MTL_FAST_MATH = YES;
183+
ONLY_ACTIVE_ARCH = YES;
184+
SDKROOT = macosx;
185+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
186+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
187+
};
188+
name = Debug;
189+
};
190+
06C3540621DDC381001D911D /* Release */ = {
191+
isa = XCBuildConfiguration;
192+
buildSettings = {
193+
ALWAYS_SEARCH_USER_PATHS = NO;
194+
CLANG_ANALYZER_NONNULL = YES;
195+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
196+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
197+
CLANG_CXX_LIBRARY = "libc++";
198+
CLANG_ENABLE_MODULES = YES;
199+
CLANG_ENABLE_OBJC_ARC = YES;
200+
CLANG_ENABLE_OBJC_WEAK = YES;
201+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
202+
CLANG_WARN_BOOL_CONVERSION = YES;
203+
CLANG_WARN_COMMA = YES;
204+
CLANG_WARN_CONSTANT_CONVERSION = YES;
205+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
206+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
207+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
208+
CLANG_WARN_EMPTY_BODY = YES;
209+
CLANG_WARN_ENUM_CONVERSION = YES;
210+
CLANG_WARN_INFINITE_RECURSION = YES;
211+
CLANG_WARN_INT_CONVERSION = YES;
212+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
213+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
214+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
215+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
216+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
217+
CLANG_WARN_STRICT_PROTOTYPES = YES;
218+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
219+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
220+
CLANG_WARN_UNREACHABLE_CODE = YES;
221+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
222+
CODE_SIGN_IDENTITY = "-";
223+
COPY_PHASE_STRIP = NO;
224+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
225+
ENABLE_NS_ASSERTIONS = NO;
226+
ENABLE_STRICT_OBJC_MSGSEND = YES;
227+
GCC_C_LANGUAGE_STANDARD = gnu11;
228+
GCC_NO_COMMON_BLOCKS = YES;
229+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
230+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
231+
GCC_WARN_UNDECLARED_SELECTOR = YES;
232+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
233+
GCC_WARN_UNUSED_FUNCTION = YES;
234+
GCC_WARN_UNUSED_VARIABLE = YES;
235+
MACOSX_DEPLOYMENT_TARGET = 10.14;
236+
MTL_ENABLE_DEBUG_INFO = NO;
237+
MTL_FAST_MATH = YES;
238+
SDKROOT = macosx;
239+
SWIFT_COMPILATION_MODE = wholemodule;
240+
SWIFT_OPTIMIZATION_LEVEL = "-O";
241+
};
242+
name = Release;
243+
};
244+
06C3540821DDC381001D911D /* Debug */ = {
245+
isa = XCBuildConfiguration;
246+
buildSettings = {
247+
CODE_SIGN_STYLE = Automatic;
248+
PRODUCT_NAME = "$(TARGET_NAME)";
249+
SWIFT_VERSION = 4.2;
250+
};
251+
name = Debug;
252+
};
253+
06C3540921DDC381001D911D /* Release */ = {
254+
isa = XCBuildConfiguration;
255+
buildSettings = {
256+
CODE_SIGN_STYLE = Automatic;
257+
PRODUCT_NAME = "$(TARGET_NAME)";
258+
SWIFT_VERSION = 4.2;
259+
};
260+
name = Release;
261+
};
262+
/* End XCBuildConfiguration section */
263+
264+
/* Begin XCConfigurationList section */
265+
06C353FB21DDC381001D911D /* Build configuration list for PBXProject "day10" */ = {
266+
isa = XCConfigurationList;
267+
buildConfigurations = (
268+
06C3540521DDC381001D911D /* Debug */,
269+
06C3540621DDC381001D911D /* Release */,
270+
);
271+
defaultConfigurationIsVisible = 0;
272+
defaultConfigurationName = Release;
273+
};
274+
06C3540721DDC381001D911D /* Build configuration list for PBXNativeTarget "day10" */ = {
275+
isa = XCConfigurationList;
276+
buildConfigurations = (
277+
06C3540821DDC381001D911D /* Debug */,
278+
06C3540921DDC381001D911D /* Release */,
279+
);
280+
defaultConfigurationIsVisible = 0;
281+
defaultConfigurationName = Release;
282+
};
283+
/* End XCConfigurationList section */
284+
};
285+
rootObject = 06C353F821DDC381001D911D /* Project object */;
286+
}

day10/day10.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

day10/day10/main.swift

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// main.swift
3+
// day10
4+
//
5+
// Created by Tyler Kieft on 1/2/19.
6+
// Copyright © 2019 Tyler Kieft. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
func transform(_ number: String) -> String {
12+
var newNumber = String()
13+
14+
var index = number.startIndex
15+
16+
repeat {
17+
let c = number[index]
18+
var cCount = 0
19+
20+
while (index < number.endIndex && number[index] == c) {
21+
cCount += 1
22+
index = number.index(after: index)
23+
}
24+
25+
newNumber.append(String(cCount))
26+
newNumber.append(c)
27+
28+
} while index < number.endIndex
29+
30+
return newNumber
31+
}
32+
33+
var input = "3113322113"
34+
35+
for _ in (0..<40) {
36+
input = transform(input)
37+
}
38+
39+
print(input.count)
40+
41+
for _ in (0..<10) {
42+
input = transform(input)
43+
}
44+
45+
print(input.count)

0 commit comments

Comments
 (0)