diff options
author | Yigit Sever | 2021-12-06 20:36:43 +0300 |
---|---|---|
committer | Yigit Sever | 2021-12-06 20:36:43 +0300 |
commit | ce9b9c411bd6c36d80fe6dd8112c8188661e2844 (patch) | |
tree | 07b3b56fb538246c411803adb5f922e91bbecaf0 /2021/day2 | |
parent | 9324fbc1cfd397d803a255c958d51d258bd4aa7c (diff) | |
download | aoc-ce9b9c411bd6c36d80fe6dd8112c8188661e2844.tar.gz aoc-ce9b9c411bd6c36d80fe6dd8112c8188661e2844.tar.bz2 aoc-ce9b9c411bd6c36d80fe6dd8112c8188661e2844.zip |
2021, day2: start
Diffstat (limited to '2021/day2')
-rw-r--r-- | 2021/day2/.clang-format | 563 | ||||
-rw-r--r-- | 2021/day2/Makefile | 11 | ||||
-rw-r--r-- | 2021/day2/input | 1000 | ||||
-rw-r--r-- | 2021/day2/input.example | 6 | ||||
-rw-r--r-- | 2021/day2/pilot.c | 34 |
5 files changed, 1614 insertions, 0 deletions
diff --git a/2021/day2/.clang-format b/2021/day2/.clang-format new file mode 100644 index 0000000..ee17a69 --- /dev/null +++ b/2021/day2/.clang-format | |||
@@ -0,0 +1,563 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
2 | # | ||
3 | # clang-format configuration file. Intended for clang-format >= 4. | ||
4 | # | ||
5 | # For more information, see: | ||
6 | # | ||
7 | # Documentation/process/clang-format.rst | ||
8 | # https://clang.llvm.org/docs/ClangFormat.html | ||
9 | # https://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
10 | # | ||
11 | --- | ||
12 | BasedOnStyle: LLVM | ||
13 | IndentWidth: 8 | ||
14 | UseTab: Always | ||
15 | BreakBeforeBraces: Linux | ||
16 | AllowShortIfStatementsOnASingleLine: false | ||
17 | IndentCaseLabels: false | ||
18 | AccessModifierOffset: -4 | ||
19 | AlignAfterOpenBracket: Align | ||
20 | AlignConsecutiveAssignments: None | ||
21 | AlignConsecutiveDeclarations: false | ||
22 | |||
23 | #AlignEscapedNewlines: Left # Unknown to clang-format-4.0 | ||
24 | AlignOperands: true | ||
25 | AlignTrailingComments: false | ||
26 | AllowAllParametersOfDeclarationOnNextLine: false | ||
27 | AllowShortBlocksOnASingleLine: false | ||
28 | AllowShortCaseLabelsOnASingleLine: false | ||
29 | AllowShortFunctionsOnASingleLine: None | ||
30 | AllowShortLoopsOnASingleLine: false | ||
31 | AlwaysBreakAfterDefinitionReturnType: None | ||
32 | AlwaysBreakAfterReturnType: None | ||
33 | AlwaysBreakBeforeMultilineStrings: false | ||
34 | AlwaysBreakTemplateDeclarations: false | ||
35 | BinPackArguments: true | ||
36 | BinPackParameters: true | ||
37 | BraceWrapping: | ||
38 | AfterClass: false | ||
39 | AfterControlStatement: false | ||
40 | AfterEnum: false | ||
41 | AfterFunction: true | ||
42 | AfterNamespace: true | ||
43 | AfterObjCDeclaration: false | ||
44 | AfterStruct: false | ||
45 | AfterUnion: false | ||
46 | #AfterExternBlock: false # Unknown to clang-format-5.0 | ||
47 | BeforeCatch: false | ||
48 | BeforeElse: false | ||
49 | IndentBraces: false | ||
50 | #SplitEmptyFunction: true # Unknown to clang-format-4.0 | ||
51 | #SplitEmptyRecord: true # Unknown to clang-format-4.0 | ||
52 | #SplitEmptyNamespace: true # Unknown to clang-format-4.0 | ||
53 | BreakBeforeBinaryOperators: true | ||
54 | #BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0 | ||
55 | BreakBeforeTernaryOperators: false | ||
56 | BreakConstructorInitializersBeforeComma: false | ||
57 | #BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0 | ||
58 | BreakAfterJavaFieldAnnotations: false | ||
59 | BreakStringLiterals: false | ||
60 | ColumnLimit: 80 | ||
61 | CommentPragmas: '^ IWYU pragma:' | ||
62 | #CompactNamespaces: false # Unknown to clang-format-4.0 | ||
63 | ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
64 | ConstructorInitializerIndentWidth: 8 | ||
65 | ContinuationIndentWidth: 8 | ||
66 | Cpp11BracedListStyle: false | ||
67 | DerivePointerAlignment: false | ||
68 | DisableFormat: false | ||
69 | ExperimentalAutoDetectBinPacking: false | ||
70 | #FixNamespaceComments: false # Unknown to clang-format-4.0 | ||
71 | |||
72 | # Taken from: | ||
73 | # git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \ | ||
74 | # | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \ | ||
75 | # | sort | uniq | ||
76 | ForEachMacros: | ||
77 | - 'apei_estatus_for_each_section' | ||
78 | - 'ata_for_each_dev' | ||
79 | - 'ata_for_each_link' | ||
80 | - '__ata_qc_for_each' | ||
81 | - 'ata_qc_for_each' | ||
82 | - 'ata_qc_for_each_raw' | ||
83 | - 'ata_qc_for_each_with_internal' | ||
84 | - 'ax25_for_each' | ||
85 | - 'ax25_uid_for_each' | ||
86 | - '__bio_for_each_bvec' | ||
87 | - 'bio_for_each_bvec' | ||
88 | - 'bio_for_each_bvec_all' | ||
89 | - 'bio_for_each_integrity_vec' | ||
90 | - '__bio_for_each_segment' | ||
91 | - 'bio_for_each_segment' | ||
92 | - 'bio_for_each_segment_all' | ||
93 | - 'bio_list_for_each' | ||
94 | - 'bip_for_each_vec' | ||
95 | - 'bitmap_for_each_clear_region' | ||
96 | - 'bitmap_for_each_set_region' | ||
97 | - 'blkg_for_each_descendant_post' | ||
98 | - 'blkg_for_each_descendant_pre' | ||
99 | - 'blk_queue_for_each_rl' | ||
100 | - 'bond_for_each_slave' | ||
101 | - 'bond_for_each_slave_rcu' | ||
102 | - 'bpf_for_each_spilled_reg' | ||
103 | - 'btree_for_each_safe128' | ||
104 | - 'btree_for_each_safe32' | ||
105 | - 'btree_for_each_safe64' | ||
106 | - 'btree_for_each_safel' | ||
107 | - 'card_for_each_dev' | ||
108 | - 'cgroup_taskset_for_each' | ||
109 | - 'cgroup_taskset_for_each_leader' | ||
110 | - 'cpufreq_for_each_entry' | ||
111 | - 'cpufreq_for_each_entry_idx' | ||
112 | - 'cpufreq_for_each_valid_entry' | ||
113 | - 'cpufreq_for_each_valid_entry_idx' | ||
114 | - 'css_for_each_child' | ||
115 | - 'css_for_each_descendant_post' | ||
116 | - 'css_for_each_descendant_pre' | ||
117 | - 'device_for_each_child_node' | ||
118 | - 'displayid_iter_for_each' | ||
119 | - 'dma_fence_chain_for_each' | ||
120 | - 'do_for_each_ftrace_op' | ||
121 | - 'drm_atomic_crtc_for_each_plane' | ||
122 | - 'drm_atomic_crtc_state_for_each_plane' | ||
123 | - 'drm_atomic_crtc_state_for_each_plane_state' | ||
124 | - 'drm_atomic_for_each_plane_damage' | ||
125 | - 'drm_client_for_each_connector_iter' | ||
126 | - 'drm_client_for_each_modeset' | ||
127 | - 'drm_connector_for_each_possible_encoder' | ||
128 | - 'drm_for_each_bridge_in_chain' | ||
129 | - 'drm_for_each_connector_iter' | ||
130 | - 'drm_for_each_crtc' | ||
131 | - 'drm_for_each_crtc_reverse' | ||
132 | - 'drm_for_each_encoder' | ||
133 | - 'drm_for_each_encoder_mask' | ||
134 | - 'drm_for_each_fb' | ||
135 | - 'drm_for_each_legacy_plane' | ||
136 | - 'drm_for_each_plane' | ||
137 | - 'drm_for_each_plane_mask' | ||
138 | - 'drm_for_each_privobj' | ||
139 | - 'drm_mm_for_each_hole' | ||
140 | - 'drm_mm_for_each_node' | ||
141 | - 'drm_mm_for_each_node_in_range' | ||
142 | - 'drm_mm_for_each_node_safe' | ||
143 | - 'flow_action_for_each' | ||
144 | - 'for_each_acpi_dev_match' | ||
145 | - 'for_each_active_dev_scope' | ||
146 | - 'for_each_active_drhd_unit' | ||
147 | - 'for_each_active_iommu' | ||
148 | - 'for_each_aggr_pgid' | ||
149 | - 'for_each_available_child_of_node' | ||
150 | - 'for_each_bio' | ||
151 | - 'for_each_board_func_rsrc' | ||
152 | - 'for_each_bvec' | ||
153 | - 'for_each_card_auxs' | ||
154 | - 'for_each_card_auxs_safe' | ||
155 | - 'for_each_card_components' | ||
156 | - 'for_each_card_dapms' | ||
157 | - 'for_each_card_pre_auxs' | ||
158 | - 'for_each_card_prelinks' | ||
159 | - 'for_each_card_rtds' | ||
160 | - 'for_each_card_rtds_safe' | ||
161 | - 'for_each_card_widgets' | ||
162 | - 'for_each_card_widgets_safe' | ||
163 | - 'for_each_cgroup_storage_type' | ||
164 | - 'for_each_child_of_node' | ||
165 | - 'for_each_clear_bit' | ||
166 | - 'for_each_clear_bit_from' | ||
167 | - 'for_each_cmsghdr' | ||
168 | - 'for_each_compatible_node' | ||
169 | - 'for_each_component_dais' | ||
170 | - 'for_each_component_dais_safe' | ||
171 | - 'for_each_comp_order' | ||
172 | - 'for_each_console' | ||
173 | - 'for_each_cpu' | ||
174 | - 'for_each_cpu_and' | ||
175 | - 'for_each_cpu_not' | ||
176 | - 'for_each_cpu_wrap' | ||
177 | - 'for_each_dapm_widgets' | ||
178 | - 'for_each_dev_addr' | ||
179 | - 'for_each_dev_scope' | ||
180 | - 'for_each_dma_cap_mask' | ||
181 | - 'for_each_dpcm_be' | ||
182 | - 'for_each_dpcm_be_rollback' | ||
183 | - 'for_each_dpcm_be_safe' | ||
184 | - 'for_each_dpcm_fe' | ||
185 | - 'for_each_drhd_unit' | ||
186 | - 'for_each_dss_dev' | ||
187 | - 'for_each_dtpm_table' | ||
188 | - 'for_each_efi_memory_desc' | ||
189 | - 'for_each_efi_memory_desc_in_map' | ||
190 | - 'for_each_element' | ||
191 | - 'for_each_element_extid' | ||
192 | - 'for_each_element_id' | ||
193 | - 'for_each_endpoint_of_node' | ||
194 | - 'for_each_evictable_lru' | ||
195 | - 'for_each_fib6_node_rt_rcu' | ||
196 | - 'for_each_fib6_walker_rt' | ||
197 | - 'for_each_free_mem_pfn_range_in_zone' | ||
198 | - 'for_each_free_mem_pfn_range_in_zone_from' | ||
199 | - 'for_each_free_mem_range' | ||
200 | - 'for_each_free_mem_range_reverse' | ||
201 | - 'for_each_func_rsrc' | ||
202 | - 'for_each_hstate' | ||
203 | - 'for_each_if' | ||
204 | - 'for_each_iommu' | ||
205 | - 'for_each_ip_tunnel_rcu' | ||
206 | - 'for_each_irq_nr' | ||
207 | - 'for_each_link_codecs' | ||
208 | - 'for_each_link_cpus' | ||
209 | - 'for_each_link_platforms' | ||
210 | - 'for_each_lru' | ||
211 | - 'for_each_matching_node' | ||
212 | - 'for_each_matching_node_and_match' | ||
213 | - 'for_each_member' | ||
214 | - 'for_each_memcg_cache_index' | ||
215 | - 'for_each_mem_pfn_range' | ||
216 | - '__for_each_mem_range' | ||
217 | - 'for_each_mem_range' | ||
218 | - '__for_each_mem_range_rev' | ||
219 | - 'for_each_mem_range_rev' | ||
220 | - 'for_each_mem_region' | ||
221 | - 'for_each_migratetype_order' | ||
222 | - 'for_each_msi_entry' | ||
223 | - 'for_each_msi_entry_safe' | ||
224 | - 'for_each_msi_vector' | ||
225 | - 'for_each_net' | ||
226 | - 'for_each_net_continue_reverse' | ||
227 | - 'for_each_netdev' | ||
228 | - 'for_each_netdev_continue' | ||
229 | - 'for_each_netdev_continue_rcu' | ||
230 | - 'for_each_netdev_continue_reverse' | ||
231 | - 'for_each_netdev_feature' | ||
232 | - 'for_each_netdev_in_bond_rcu' | ||
233 | - 'for_each_netdev_rcu' | ||
234 | - 'for_each_netdev_reverse' | ||
235 | - 'for_each_netdev_safe' | ||
236 | - 'for_each_net_rcu' | ||
237 | - 'for_each_new_connector_in_state' | ||
238 | - 'for_each_new_crtc_in_state' | ||
239 | - 'for_each_new_mst_mgr_in_state' | ||
240 | - 'for_each_new_plane_in_state' | ||
241 | - 'for_each_new_private_obj_in_state' | ||
242 | - 'for_each_node' | ||
243 | - 'for_each_node_by_name' | ||
244 | - 'for_each_node_by_type' | ||
245 | - 'for_each_node_mask' | ||
246 | - 'for_each_node_state' | ||
247 | - 'for_each_node_with_cpus' | ||
248 | - 'for_each_node_with_property' | ||
249 | - 'for_each_nonreserved_multicast_dest_pgid' | ||
250 | - 'for_each_of_allnodes' | ||
251 | - 'for_each_of_allnodes_from' | ||
252 | - 'for_each_of_cpu_node' | ||
253 | - 'for_each_of_pci_range' | ||
254 | - 'for_each_old_connector_in_state' | ||
255 | - 'for_each_old_crtc_in_state' | ||
256 | - 'for_each_old_mst_mgr_in_state' | ||
257 | - 'for_each_oldnew_connector_in_state' | ||
258 | - 'for_each_oldnew_crtc_in_state' | ||
259 | - 'for_each_oldnew_mst_mgr_in_state' | ||
260 | - 'for_each_oldnew_plane_in_state' | ||
261 | - 'for_each_oldnew_plane_in_state_reverse' | ||
262 | - 'for_each_oldnew_private_obj_in_state' | ||
263 | - 'for_each_old_plane_in_state' | ||
264 | - 'for_each_old_private_obj_in_state' | ||
265 | - 'for_each_online_cpu' | ||
266 | - 'for_each_online_node' | ||
267 | - 'for_each_online_pgdat' | ||
268 | - 'for_each_pci_bridge' | ||
269 | - 'for_each_pci_dev' | ||
270 | - 'for_each_pci_msi_entry' | ||
271 | - 'for_each_pcm_streams' | ||
272 | - 'for_each_physmem_range' | ||
273 | - 'for_each_populated_zone' | ||
274 | - 'for_each_possible_cpu' | ||
275 | - 'for_each_present_cpu' | ||
276 | - 'for_each_prime_number' | ||
277 | - 'for_each_prime_number_from' | ||
278 | - 'for_each_process' | ||
279 | - 'for_each_process_thread' | ||
280 | - 'for_each_prop_codec_conf' | ||
281 | - 'for_each_prop_dai_codec' | ||
282 | - 'for_each_prop_dai_cpu' | ||
283 | - 'for_each_prop_dlc_codecs' | ||
284 | - 'for_each_prop_dlc_cpus' | ||
285 | - 'for_each_prop_dlc_platforms' | ||
286 | - 'for_each_property_of_node' | ||
287 | - 'for_each_registered_fb' | ||
288 | - 'for_each_requested_gpio' | ||
289 | - 'for_each_requested_gpio_in_range' | ||
290 | - 'for_each_reserved_mem_range' | ||
291 | - 'for_each_reserved_mem_region' | ||
292 | - 'for_each_rtd_codec_dais' | ||
293 | - 'for_each_rtd_components' | ||
294 | - 'for_each_rtd_cpu_dais' | ||
295 | - 'for_each_rtd_dais' | ||
296 | - 'for_each_set_bit' | ||
297 | - 'for_each_set_bit_from' | ||
298 | - 'for_each_set_clump8' | ||
299 | - 'for_each_sg' | ||
300 | - 'for_each_sg_dma_page' | ||
301 | - 'for_each_sg_page' | ||
302 | - 'for_each_sgtable_dma_page' | ||
303 | - 'for_each_sgtable_dma_sg' | ||
304 | - 'for_each_sgtable_page' | ||
305 | - 'for_each_sgtable_sg' | ||
306 | - 'for_each_sibling_event' | ||
307 | - 'for_each_subelement' | ||
308 | - 'for_each_subelement_extid' | ||
309 | - 'for_each_subelement_id' | ||
310 | - '__for_each_thread' | ||
311 | - 'for_each_thread' | ||
312 | - 'for_each_unicast_dest_pgid' | ||
313 | - 'for_each_vsi' | ||
314 | - 'for_each_wakeup_source' | ||
315 | - 'for_each_zone' | ||
316 | - 'for_each_zone_zonelist' | ||
317 | - 'for_each_zone_zonelist_nodemask' | ||
318 | - 'fwnode_for_each_available_child_node' | ||
319 | - 'fwnode_for_each_child_node' | ||
320 | - 'fwnode_graph_for_each_endpoint' | ||
321 | - 'gadget_for_each_ep' | ||
322 | - 'genradix_for_each' | ||
323 | - 'genradix_for_each_from' | ||
324 | - 'hash_for_each' | ||
325 | - 'hash_for_each_possible' | ||
326 | - 'hash_for_each_possible_rcu' | ||
327 | - 'hash_for_each_possible_rcu_notrace' | ||
328 | - 'hash_for_each_possible_safe' | ||
329 | - 'hash_for_each_rcu' | ||
330 | - 'hash_for_each_safe' | ||
331 | - 'hctx_for_each_ctx' | ||
332 | - 'hlist_bl_for_each_entry' | ||
333 | - 'hlist_bl_for_each_entry_rcu' | ||
334 | - 'hlist_bl_for_each_entry_safe' | ||
335 | - 'hlist_for_each' | ||
336 | - 'hlist_for_each_entry' | ||
337 | - 'hlist_for_each_entry_continue' | ||
338 | - 'hlist_for_each_entry_continue_rcu' | ||
339 | - 'hlist_for_each_entry_continue_rcu_bh' | ||
340 | - 'hlist_for_each_entry_from' | ||
341 | - 'hlist_for_each_entry_from_rcu' | ||
342 | - 'hlist_for_each_entry_rcu' | ||
343 | - 'hlist_for_each_entry_rcu_bh' | ||
344 | - 'hlist_for_each_entry_rcu_notrace' | ||
345 | - 'hlist_for_each_entry_safe' | ||
346 | - 'hlist_for_each_entry_srcu' | ||
347 | - '__hlist_for_each_rcu' | ||
348 | - 'hlist_for_each_safe' | ||
349 | - 'hlist_nulls_for_each_entry' | ||
350 | - 'hlist_nulls_for_each_entry_from' | ||
351 | - 'hlist_nulls_for_each_entry_rcu' | ||
352 | - 'hlist_nulls_for_each_entry_safe' | ||
353 | - 'i3c_bus_for_each_i2cdev' | ||
354 | - 'i3c_bus_for_each_i3cdev' | ||
355 | - 'ide_host_for_each_port' | ||
356 | - 'ide_port_for_each_dev' | ||
357 | - 'ide_port_for_each_present_dev' | ||
358 | - 'idr_for_each_entry' | ||
359 | - 'idr_for_each_entry_continue' | ||
360 | - 'idr_for_each_entry_continue_ul' | ||
361 | - 'idr_for_each_entry_ul' | ||
362 | - 'in_dev_for_each_ifa_rcu' | ||
363 | - 'in_dev_for_each_ifa_rtnl' | ||
364 | - 'inet_bind_bucket_for_each' | ||
365 | - 'inet_lhash2_for_each_icsk_rcu' | ||
366 | - 'key_for_each' | ||
367 | - 'key_for_each_safe' | ||
368 | - 'klp_for_each_func' | ||
369 | - 'klp_for_each_func_safe' | ||
370 | - 'klp_for_each_func_static' | ||
371 | - 'klp_for_each_object' | ||
372 | - 'klp_for_each_object_safe' | ||
373 | - 'klp_for_each_object_static' | ||
374 | - 'kunit_suite_for_each_test_case' | ||
375 | - 'kvm_for_each_memslot' | ||
376 | - 'kvm_for_each_vcpu' | ||
377 | - 'list_for_each' | ||
378 | - 'list_for_each_codec' | ||
379 | - 'list_for_each_codec_safe' | ||
380 | - 'list_for_each_continue' | ||
381 | - 'list_for_each_entry' | ||
382 | - 'list_for_each_entry_continue' | ||
383 | - 'list_for_each_entry_continue_rcu' | ||
384 | - 'list_for_each_entry_continue_reverse' | ||
385 | - 'list_for_each_entry_from' | ||
386 | - 'list_for_each_entry_from_rcu' | ||
387 | - 'list_for_each_entry_from_reverse' | ||
388 | - 'list_for_each_entry_lockless' | ||
389 | - 'list_for_each_entry_rcu' | ||
390 | - 'list_for_each_entry_reverse' | ||
391 | - 'list_for_each_entry_safe' | ||
392 | - 'list_for_each_entry_safe_continue' | ||
393 | - 'list_for_each_entry_safe_from' | ||
394 | - 'list_for_each_entry_safe_reverse' | ||
395 | - 'list_for_each_entry_srcu' | ||
396 | - 'list_for_each_prev' | ||
397 | - 'list_for_each_prev_safe' | ||
398 | - 'list_for_each_safe' | ||
399 | - 'llist_for_each' | ||
400 | - 'llist_for_each_entry' | ||
401 | - 'llist_for_each_entry_safe' | ||
402 | - 'llist_for_each_safe' | ||
403 | - 'mci_for_each_dimm' | ||
404 | - 'media_device_for_each_entity' | ||
405 | - 'media_device_for_each_intf' | ||
406 | - 'media_device_for_each_link' | ||
407 | - 'media_device_for_each_pad' | ||
408 | - 'nanddev_io_for_each_page' | ||
409 | - 'netdev_for_each_lower_dev' | ||
410 | - 'netdev_for_each_lower_private' | ||
411 | - 'netdev_for_each_lower_private_rcu' | ||
412 | - 'netdev_for_each_mc_addr' | ||
413 | - 'netdev_for_each_uc_addr' | ||
414 | - 'netdev_for_each_upper_dev_rcu' | ||
415 | - 'netdev_hw_addr_list_for_each' | ||
416 | - 'nft_rule_for_each_expr' | ||
417 | - 'nla_for_each_attr' | ||
418 | - 'nla_for_each_nested' | ||
419 | - 'nlmsg_for_each_attr' | ||
420 | - 'nlmsg_for_each_msg' | ||
421 | - 'nr_neigh_for_each' | ||
422 | - 'nr_neigh_for_each_safe' | ||
423 | - 'nr_node_for_each' | ||
424 | - 'nr_node_for_each_safe' | ||
425 | - 'of_for_each_phandle' | ||
426 | - 'of_property_for_each_string' | ||
427 | - 'of_property_for_each_u32' | ||
428 | - 'pci_bus_for_each_resource' | ||
429 | - 'pcl_for_each_chunk' | ||
430 | - 'pcl_for_each_segment' | ||
431 | - 'pcm_for_each_format' | ||
432 | - 'ping_portaddr_for_each_entry' | ||
433 | - 'plist_for_each' | ||
434 | - 'plist_for_each_continue' | ||
435 | - 'plist_for_each_entry' | ||
436 | - 'plist_for_each_entry_continue' | ||
437 | - 'plist_for_each_entry_safe' | ||
438 | - 'plist_for_each_safe' | ||
439 | - 'pnp_for_each_card' | ||
440 | - 'pnp_for_each_dev' | ||
441 | - 'protocol_for_each_card' | ||
442 | - 'protocol_for_each_dev' | ||
443 | - 'queue_for_each_hw_ctx' | ||
444 | - 'radix_tree_for_each_slot' | ||
445 | - 'radix_tree_for_each_tagged' | ||
446 | - 'rb_for_each' | ||
447 | - 'rbtree_postorder_for_each_entry_safe' | ||
448 | - 'rdma_for_each_block' | ||
449 | - 'rdma_for_each_port' | ||
450 | - 'rdma_umem_for_each_dma_block' | ||
451 | - 'resource_list_for_each_entry' | ||
452 | - 'resource_list_for_each_entry_safe' | ||
453 | - 'rhl_for_each_entry_rcu' | ||
454 | - 'rhl_for_each_rcu' | ||
455 | - 'rht_for_each' | ||
456 | - 'rht_for_each_entry' | ||
457 | - 'rht_for_each_entry_from' | ||
458 | - 'rht_for_each_entry_rcu' | ||
459 | - 'rht_for_each_entry_rcu_from' | ||
460 | - 'rht_for_each_entry_safe' | ||
461 | - 'rht_for_each_from' | ||
462 | - 'rht_for_each_rcu' | ||
463 | - 'rht_for_each_rcu_from' | ||
464 | - '__rq_for_each_bio' | ||
465 | - 'rq_for_each_bvec' | ||
466 | - 'rq_for_each_segment' | ||
467 | - 'scsi_for_each_prot_sg' | ||
468 | - 'scsi_for_each_sg' | ||
469 | - 'sctp_for_each_hentry' | ||
470 | - 'sctp_skb_for_each' | ||
471 | - 'shdma_for_each_chan' | ||
472 | - '__shost_for_each_device' | ||
473 | - 'shost_for_each_device' | ||
474 | - 'sk_for_each' | ||
475 | - 'sk_for_each_bound' | ||
476 | - 'sk_for_each_entry_offset_rcu' | ||
477 | - 'sk_for_each_from' | ||
478 | - 'sk_for_each_rcu' | ||
479 | - 'sk_for_each_safe' | ||
480 | - 'sk_nulls_for_each' | ||
481 | - 'sk_nulls_for_each_from' | ||
482 | - 'sk_nulls_for_each_rcu' | ||
483 | - 'snd_array_for_each' | ||
484 | - 'snd_pcm_group_for_each_entry' | ||
485 | - 'snd_soc_dapm_widget_for_each_path' | ||
486 | - 'snd_soc_dapm_widget_for_each_path_safe' | ||
487 | - 'snd_soc_dapm_widget_for_each_sink_path' | ||
488 | - 'snd_soc_dapm_widget_for_each_source_path' | ||
489 | - 'tb_property_for_each' | ||
490 | - 'tcf_exts_for_each_action' | ||
491 | - 'udp_portaddr_for_each_entry' | ||
492 | - 'udp_portaddr_for_each_entry_rcu' | ||
493 | - 'usb_hub_for_each_child' | ||
494 | - 'v4l2_device_for_each_subdev' | ||
495 | - 'v4l2_m2m_for_each_dst_buf' | ||
496 | - 'v4l2_m2m_for_each_dst_buf_safe' | ||
497 | - 'v4l2_m2m_for_each_src_buf' | ||
498 | - 'v4l2_m2m_for_each_src_buf_safe' | ||
499 | - 'virtio_device_for_each_vq' | ||
500 | - 'while_for_each_ftrace_op' | ||
501 | - 'xa_for_each' | ||
502 | - 'xa_for_each_marked' | ||
503 | - 'xa_for_each_range' | ||
504 | - 'xa_for_each_start' | ||
505 | - 'xas_for_each' | ||
506 | - 'xas_for_each_conflict' | ||
507 | - 'xas_for_each_marked' | ||
508 | - 'xbc_array_for_each_value' | ||
509 | - 'xbc_for_each_key_value' | ||
510 | - 'xbc_node_for_each_array_value' | ||
511 | - 'xbc_node_for_each_child' | ||
512 | - 'xbc_node_for_each_key_value' | ||
513 | - 'zorro_for_each_dev' | ||
514 | |||
515 | #IncludeBlocks: Preserve # Unknown to clang-format-5.0 | ||
516 | IncludeCategories: | ||
517 | - Regex: '.*' | ||
518 | Priority: 1 | ||
519 | IncludeIsMainRegex: '(Test)?$' | ||
520 | #IndentPPDirectives: None # Unknown to clang-format-5.0 | ||
521 | IndentWrappedFunctionNames: false | ||
522 | JavaScriptQuotes: Leave | ||
523 | JavaScriptWrapImports: true | ||
524 | KeepEmptyLinesAtTheStartOfBlocks: false | ||
525 | MacroBlockBegin: '' | ||
526 | MacroBlockEnd: '' | ||
527 | MaxEmptyLinesToKeep: 1 | ||
528 | NamespaceIndentation: None | ||
529 | #ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0 | ||
530 | ObjCBlockIndentWidth: 8 | ||
531 | ObjCSpaceAfterProperty: true | ||
532 | ObjCSpaceBeforeProtocolList: true | ||
533 | |||
534 | # Taken from git's rules | ||
535 | #PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0 | ||
536 | PenaltyBreakBeforeFirstCallParameter: 30 | ||
537 | PenaltyBreakComment: 10 | ||
538 | PenaltyBreakFirstLessLess: 0 | ||
539 | PenaltyBreakString: 10 | ||
540 | PenaltyExcessCharacter: 100 | ||
541 | PenaltyReturnTypeOnItsOwnLine: 60 | ||
542 | |||
543 | PointerAlignment: Right | ||
544 | ReflowComments: true | ||
545 | SortIncludes: false | ||
546 | #SortUsingDeclarations: false # Unknown to clang-format-4.0 | ||
547 | SpaceAfterCStyleCast: false | ||
548 | SpaceAfterTemplateKeyword: true | ||
549 | SpaceBeforeAssignmentOperators: true | ||
550 | #SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0 | ||
551 | #SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0 | ||
552 | SpaceBeforeParens: ControlStatements | ||
553 | #SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0 | ||
554 | SpaceInEmptyParentheses: false | ||
555 | SpacesBeforeTrailingComments: 1 | ||
556 | SpacesInAngles: false | ||
557 | SpacesInContainerLiterals: false | ||
558 | SpacesInCStyleCastParentheses: false | ||
559 | SpacesInParentheses: false | ||
560 | SpacesInSquareBrackets: false | ||
561 | Standard: Cpp03 | ||
562 | TabWidth: 8 | ||
563 | ... | ||
diff --git a/2021/day2/Makefile b/2021/day2/Makefile new file mode 100644 index 0000000..6718c4c --- /dev/null +++ b/2021/day2/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | src = $(wildcard *.c) | ||
2 | obj = $(src:.c=.o) | ||
3 | |||
4 | LDFLAGS = -Wall -g | ||
5 | |||
6 | pilot: $(obj) | ||
7 | $(CC) -o $@ $^ $(LDFLAGS) | ||
8 | |||
9 | .PHONY: clean | ||
10 | clean: | ||
11 | rm -f $(obj) pilot | ||
diff --git a/2021/day2/input b/2021/day2/input new file mode 100644 index 0000000..f9ca46c --- /dev/null +++ b/2021/day2/input | |||
@@ -0,0 +1,1000 @@ | |||
1 | forward 3 | ||
2 | down 9 | ||
3 | forward 5 | ||
4 | up 1 | ||
5 | forward 2 | ||
6 | down 1 | ||
7 | down 7 | ||
8 | down 5 | ||
9 | up 6 | ||
10 | forward 3 | ||
11 | down 6 | ||
12 | forward 9 | ||
13 | down 6 | ||
14 | forward 2 | ||
15 | down 4 | ||
16 | forward 4 | ||
17 | down 9 | ||
18 | down 7 | ||
19 | down 2 | ||
20 | down 4 | ||
21 | forward 3 | ||
22 | forward 6 | ||
23 | down 3 | ||
24 | up 1 | ||
25 | down 5 | ||
26 | down 8 | ||
27 | down 1 | ||
28 | forward 9 | ||
29 | forward 4 | ||
30 | forward 3 | ||
31 | down 3 | ||
32 | down 6 | ||
33 | down 3 | ||
34 | up 2 | ||
35 | down 3 | ||
36 | down 9 | ||
37 | down 1 | ||
38 | down 9 | ||
39 | up 8 | ||
40 | down 1 | ||
41 | down 9 | ||
42 | forward 9 | ||
43 | forward 2 | ||
44 | down 1 | ||
45 | forward 2 | ||
46 | down 9 | ||
47 | forward 9 | ||
48 | up 7 | ||
49 | forward 1 | ||
50 | up 8 | ||
51 | forward 7 | ||
52 | forward 6 | ||
53 | forward 2 | ||
54 | down 8 | ||
55 | forward 7 | ||
56 | down 3 | ||
57 | down 2 | ||
58 | down 1 | ||
59 | forward 2 | ||
60 | down 6 | ||
61 | forward 8 | ||
62 | down 7 | ||
63 | forward 9 | ||
64 | down 7 | ||
65 | down 9 | ||
66 | forward 2 | ||
67 | forward 2 | ||
68 | up 3 | ||
69 | down 4 | ||
70 | down 8 | ||
71 | forward 5 | ||
72 | down 4 | ||
73 | down 8 | ||
74 | down 2 | ||
75 | up 7 | ||
76 | down 7 | ||
77 | up 9 | ||
78 | up 9 | ||
79 | up 1 | ||
80 | forward 2 | ||
81 | up 4 | ||
82 | forward 5 | ||
83 | forward 9 | ||
84 | forward 9 | ||
85 | forward 3 | ||
86 | down 6 | ||
87 | up 3 | ||
88 | down 1 | ||
89 | forward 8 | ||
90 | forward 2 | ||
91 | down 7 | ||
92 | forward 9 | ||
93 | forward 1 | ||
94 | forward 8 | ||
95 | forward 8 | ||
96 | down 2 | ||
97 | down 6 | ||
98 | forward 8 | ||
99 | forward 8 | ||
100 | forward 3 | ||
101 | forward 4 | ||
102 | down 3 | ||
103 | up 3 | ||
104 | forward 1 | ||
105 | forward 4 | ||
106 | down 1 | ||
107 | down 4 | ||
108 | down 2 | ||
109 | down 3 | ||
110 | forward 5 | ||
111 | down 3 | ||
112 | up 5 | ||
113 | forward 9 | ||
114 | down 8 | ||
115 | up 6 | ||
116 | down 6 | ||
117 | up 7 | ||
118 | up 7 | ||
119 | forward 1 | ||
120 | forward 7 | ||
121 | down 1 | ||
122 | up 3 | ||
123 | down 1 | ||
124 | forward 7 | ||
125 | forward 1 | ||
126 | forward 9 | ||
127 | down 2 | ||
128 | forward 9 | ||
129 | down 3 | ||
130 | down 5 | ||
131 | forward 2 | ||
132 | up 3 | ||
133 | forward 5 | ||
134 | forward 5 | ||
135 | down 8 | ||
136 | down 7 | ||
137 | forward 6 | ||
138 | down 2 | ||
139 | down 5 | ||
140 | up 4 | ||
141 | up 5 | ||
142 | down 6 | ||
143 | forward 5 | ||
144 | down 3 | ||
145 | down 8 | ||
146 | forward 7 | ||
147 | down 5 | ||
148 | down 5 | ||
149 | down 9 | ||
150 | down 9 | ||
151 | down 2 | ||
152 | down 7 | ||
153 | up 4 | ||
154 | forward 8 | ||
155 | up 6 | ||
156 | down 5 | ||
157 | forward 1 | ||
158 | up 2 | ||
159 | down 6 | ||
160 | up 8 | ||
161 | up 7 | ||
162 | down 6 | ||
163 | forward 4 | ||
164 | down 6 | ||
165 | up 6 | ||
166 | up 4 | ||
167 | forward 5 | ||
168 | forward 4 | ||
169 | forward 6 | ||
170 | down 3 | ||
171 | down 7 | ||
172 | down 9 | ||
173 | forward 2 | ||
174 | forward 6 | ||
175 | down 3 | ||
176 | forward 1 | ||
177 | forward 2 | ||
178 | forward 9 | ||
179 | up 5 | ||
180 | down 7 | ||
181 | down 6 | ||
182 | forward 2 | ||
183 | forward 1 | ||
184 | up 3 | ||
185 | down 8 | ||
186 | forward 9 | ||
187 | down 7 | ||
188 | forward 7 | ||
189 | up 2 | ||
190 | up 8 | ||
191 | up 8 | ||
192 | forward 7 | ||
193 | forward 5 | ||
194 | forward 9 | ||
195 | down 7 | ||
196 | down 7 | ||
197 | forward 5 | ||
198 | forward 4 | ||
199 | forward 2 | ||
200 | forward 8 | ||
201 | up 3 | ||
202 | up 7 | ||
203 | forward 8 | ||
204 | forward 6 | ||
205 | forward 2 | ||
206 | forward 6 | ||
207 | up 3 | ||
208 | up 1 | ||
209 | forward 6 | ||
210 | forward 9 | ||
211 | down 1 | ||
212 | forward 6 | ||
213 | forward 4 | ||
214 | up 6 | ||
215 | forward 1 | ||
216 | down 7 | ||
217 | forward 7 | ||
218 | up 5 | ||
219 | down 5 | ||
220 | down 3 | ||
221 | forward 4 | ||
222 | forward 6 | ||
223 | up 6 | ||
224 | forward 9 | ||
225 | forward 2 | ||
226 | down 7 | ||
227 | forward 9 | ||
228 | down 9 | ||
229 | forward 2 | ||
230 | up 1 | ||
231 | down 4 | ||
232 | forward 6 | ||
233 | forward 4 | ||
234 | down 6 | ||
235 | forward 1 | ||
236 | up 3 | ||
237 | up 5 | ||
238 | down 8 | ||
239 | forward 2 | ||
240 | up 7 | ||
241 | down 5 | ||
242 | down 2 | ||
243 | down 6 | ||
244 | forward 7 | ||
245 | down 8 | ||
246 | up 8 | ||
247 | down 7 | ||
248 | down 9 | ||
249 | down 7 | ||
250 | down 8 | ||
251 | down 4 | ||
252 | up 3 | ||
253 | up 9 | ||
254 | down 4 | ||
255 | forward 7 | ||
256 | down 5 | ||
257 | up 8 | ||
258 | down 3 | ||
259 | forward 8 | ||
260 | down 3 | ||
261 | down 4 | ||
262 | down 1 | ||
263 | forward 5 | ||
264 | down 4 | ||
265 | down 8 | ||
266 | up 7 | ||
267 | forward 2 | ||
268 | forward 8 | ||
269 | down 1 | ||
270 | down 3 | ||
271 | forward 4 | ||
272 | forward 5 | ||
273 | forward 8 | ||
274 | forward 1 | ||
275 | down 1 | ||
276 | down 9 | ||
277 | up 8 | ||
278 | forward 6 | ||
279 | down 8 | ||
280 | down 2 | ||
281 | forward 9 | ||
282 | down 5 | ||
283 | down 8 | ||
284 | up 8 | ||
285 | up 5 | ||
286 | forward 9 | ||
287 | up 6 | ||
288 | down 9 | ||
289 | up 1 | ||
290 | down 2 | ||
291 | down 4 | ||
292 | forward 9 | ||
293 | forward 1 | ||
294 | up 2 | ||
295 | down 7 | ||
296 | forward 9 | ||
297 | down 9 | ||
298 | down 6 | ||
299 | down 9 | ||
300 | down 8 | ||
301 | forward 7 | ||
302 | forward 6 | ||
303 | forward 9 | ||
304 | forward 9 | ||
305 | forward 8 | ||
306 | forward 5 | ||
307 | up 2 | ||
308 | forward 9 | ||
309 | forward 2 | ||
310 | down 1 | ||
311 | down 1 | ||
312 | down 5 | ||
313 | down 1 | ||
314 | down 7 | ||
315 | up 2 | ||
316 | up 7 | ||
317 | forward 7 | ||
318 | forward 8 | ||
319 | down 2 | ||
320 | down 2 | ||
321 | down 3 | ||
322 | up 8 | ||
323 | up 8 | ||
324 | up 3 | ||
325 | forward 3 | ||
326 | down 7 | ||
327 | up 4 | ||
328 | up 8 | ||
329 | down 5 | ||
330 | forward 4 | ||
331 | forward 7 | ||
332 | down 9 | ||
333 | up 7 | ||
334 | forward 8 | ||
335 | forward 5 | ||
336 | forward 8 | ||
337 | forward 8 | ||
338 | forward 6 | ||
339 | forward 5 | ||
340 | forward 2 | ||
341 | down 3 | ||
342 | up 2 | ||
343 | forward 6 | ||
344 | forward 5 | ||
345 | down 9 | ||
346 | down 2 | ||
347 | down 7 | ||
348 | down 2 | ||
349 | forward 2 | ||
350 | forward 6 | ||
351 | forward 8 | ||
352 | down 7 | ||
353 | forward 4 | ||
354 | down 3 | ||
355 | down 5 | ||
356 | forward 1 | ||
357 | down 9 | ||
358 | forward 5 | ||
359 | down 4 | ||
360 | forward 9 | ||
361 | down 5 | ||
362 | down 4 | ||
363 | down 4 | ||
364 | down 7 | ||
365 | forward 9 | ||
366 | down 3 | ||
367 | down 5 | ||
368 | down 6 | ||
369 | down 4 | ||
370 | forward 4 | ||
371 | down 4 | ||
372 | up 1 | ||
373 | down 4 | ||
374 | up 7 | ||
375 | forward 4 | ||
376 | forward 5 | ||
377 | up 9 | ||
378 | down 4 | ||
379 | up 9 | ||
380 | forward 9 | ||
381 | down 8 | ||
382 | down 1 | ||
383 | up 7 | ||
384 | down 4 | ||
385 | up 4 | ||
386 | forward 9 | ||
387 | down 9 | ||
388 | down 4 | ||
389 | up 4 | ||
390 | down 5 | ||
391 | forward 2 | ||
392 | up 4 | ||
393 | down 3 | ||
394 | forward 9 | ||
395 | forward 8 | ||
396 | down 2 | ||
397 | forward 5 | ||
398 | up 5 | ||
399 | down 9 | ||
400 | down 7 | ||
401 | down 5 | ||
402 | down 9 | ||
403 | down 1 | ||
404 | down 7 | ||
405 | down 2 | ||
406 | forward 4 | ||
407 | up 7 | ||
408 | forward 7 | ||
409 | down 8 | ||
410 | down 2 | ||
411 | down 8 | ||
412 | up 6 | ||
413 | down 7 | ||
414 | down 7 | ||
415 | forward 3 | ||
416 | up 3 | ||
417 | forward 6 | ||
418 | down 8 | ||
419 | down 3 | ||
420 | up 2 | ||
421 | down 9 | ||
422 | forward 3 | ||
423 | down 9 | ||
424 | down 6 | ||
425 | up 8 | ||
426 | forward 5 | ||
427 | down 9 | ||
428 | up 2 | ||
429 | up 8 | ||
430 | down 8 | ||
431 | up 1 | ||
432 | up 2 | ||
433 | forward 5 | ||
434 | up 3 | ||
435 | down 7 | ||
436 | forward 4 | ||
437 | forward 2 | ||
438 | up 1 | ||
439 | forward 2 | ||
440 | up 1 | ||
441 | down 1 | ||
442 | down 5 | ||
443 | forward 6 | ||
444 | up 2 | ||
445 | down 7 | ||
446 | down 8 | ||
447 | down 9 | ||
448 | up 9 | ||
449 | down 2 | ||
450 | up 2 | ||
451 | forward 9 | ||
452 | forward 6 | ||
453 | forward 5 | ||
454 | down 6 | ||
455 | up 6 | ||
456 | forward 6 | ||
457 | forward 3 | ||
458 | down 3 | ||
459 | forward 2 | ||
460 | forward 4 | ||
461 | forward 1 | ||
462 | down 9 | ||
463 | forward 3 | ||
464 | forward 2 | ||
465 | down 5 | ||
466 | up 2 | ||
467 | forward 7 | ||
468 | down 4 | ||
469 | forward 5 | ||
470 | down 4 | ||
471 | forward 2 | ||
472 | down 4 | ||
473 | up 3 | ||
474 | forward 6 | ||
475 | forward 9 | ||
476 | down 1 | ||
477 | forward 2 | ||
478 | up 8 | ||
479 | forward 4 | ||
480 | up 9 | ||
481 | up 4 | ||
482 | up 3 | ||
483 | forward 5 | ||
484 | down 7 | ||
485 | forward 2 | ||
486 | up 4 | ||
487 | forward 7 | ||
488 | down 8 | ||
489 | forward 6 | ||
490 | forward 4 | ||
491 | up 5 | ||
492 | down 4 | ||
493 | down 6 | ||
494 | down 3 | ||
495 | forward 6 | ||
496 | down 9 | ||
497 | up 6 | ||
498 | forward 3 | ||
499 | down 4 | ||
500 | forward 8 | ||
501 | forward 1 | ||
502 | down 3 | ||
503 | down 4 | ||
504 | up 4 | ||
505 | forward 1 | ||
506 | up 5 | ||
507 | up 9 | ||
508 | forward 4 | ||
509 | up 9 | ||
510 | forward 2 | ||
511 | up 5 | ||
512 | up 5 | ||
513 | up 7 | ||
514 | up 4 | ||
515 | down 3 | ||
516 | forward 8 | ||
517 | forward 1 | ||
518 | up 1 | ||
519 | down 8 | ||
520 | up 3 | ||
521 | up 4 | ||
522 | up 2 | ||
523 | up 8 | ||
524 | up 7 | ||
525 | down 8 | ||
526 | up 8 | ||
527 | forward 9 | ||
528 | down 8 | ||
529 | up 5 | ||
530 | forward 6 | ||
531 | forward 4 | ||
532 | down 8 | ||
533 | down 9 | ||
534 | down 4 | ||
535 | down 6 | ||
536 | forward 4 | ||
537 | up 6 | ||
538 | up 1 | ||
539 | forward 7 | ||
540 | up 4 | ||
541 | down 6 | ||
542 | up 3 | ||
543 | down 4 | ||
544 | forward 8 | ||
545 | forward 4 | ||
546 | up 2 | ||
547 | down 3 | ||
548 | up 3 | ||
549 | up 9 | ||
550 | down 4 | ||
551 | forward 4 | ||
552 | forward 5 | ||
553 | forward 2 | ||
554 | down 1 | ||
555 | down 6 | ||
556 | down 1 | ||
557 | forward 6 | ||
558 | down 2 | ||
559 | forward 1 | ||
560 | down 2 | ||
561 | down 4 | ||
562 | forward 1 | ||
563 | down 8 | ||
564 | up 2 | ||
565 | down 5 | ||
566 | forward 9 | ||
567 | forward 4 | ||
568 | down 9 | ||
569 | forward 8 | ||
570 | forward 2 | ||
571 | forward 7 | ||
572 | forward 1 | ||
573 | forward 1 | ||
574 | down 8 | ||
575 | forward 2 | ||
576 | forward 8 | ||
577 | forward 7 | ||
578 | forward 9 | ||
579 | down 4 | ||
580 | down 2 | ||
581 | forward 1 | ||
582 | forward 2 | ||
583 | down 1 | ||
584 | forward 1 | ||
585 | forward 5 | ||
586 | down 1 | ||
587 | down 5 | ||
588 | down 1 | ||
589 | forward 2 | ||
590 | up 9 | ||
591 | forward 2 | ||
592 | forward 4 | ||
593 | down 9 | ||
594 | up 7 | ||
595 | down 1 | ||
596 | up 4 | ||
597 | forward 9 | ||
598 | up 6 | ||
599 | up 8 | ||
600 | down 3 | ||
601 | forward 9 | ||
602 | up 6 | ||
603 | down 1 | ||
604 | forward 9 | ||
605 | forward 3 | ||
606 | up 5 | ||
607 | forward 9 | ||
608 | down 1 | ||
609 | forward 5 | ||
610 | up 5 | ||
611 | down 1 | ||
612 | up 4 | ||
613 | forward 3 | ||
614 | forward 1 | ||
615 | up 4 | ||
616 | forward 3 | ||
617 | forward 9 | ||
618 | down 2 | ||
619 | forward 5 | ||
620 | forward 4 | ||
621 | forward 9 | ||
622 | down 5 | ||
623 | forward 8 | ||
624 | forward 1 | ||
625 | down 3 | ||
626 | down 2 | ||
627 | down 3 | ||
628 | up 8 | ||
629 | forward 3 | ||
630 | forward 6 | ||
631 | up 8 | ||
632 | down 6 | ||
633 | forward 8 | ||
634 | forward 1 | ||
635 | down 8 | ||
636 | down 7 | ||
637 | forward 8 | ||
638 | down 2 | ||
639 | forward 8 | ||
640 | down 4 | ||
641 | forward 1 | ||
642 | down 1 | ||
643 | up 6 | ||
644 | forward 1 | ||
645 | up 7 | ||
646 | down 2 | ||
647 | forward 5 | ||
648 | up 9 | ||
649 | down 5 | ||
650 | forward 4 | ||
651 | down 6 | ||
652 | down 9 | ||
653 | forward 8 | ||
654 | up 2 | ||
655 | up 7 | ||
656 | forward 2 | ||
657 | forward 5 | ||
658 | up 9 | ||
659 | down 4 | ||
660 | forward 9 | ||
661 | down 4 | ||
662 | down 3 | ||
663 | down 6 | ||
664 | down 9 | ||
665 | down 9 | ||
666 | down 1 | ||
667 | down 1 | ||
668 | down 7 | ||
669 | down 4 | ||
670 | down 7 | ||
671 | up 5 | ||
672 | forward 6 | ||
673 | down 9 | ||
674 | forward 7 | ||
675 | down 5 | ||
676 | down 4 | ||
677 | down 2 | ||
678 | down 4 | ||
679 | down 9 | ||
680 | forward 1 | ||
681 | down 9 | ||
682 | down 8 | ||
683 | forward 2 | ||
684 | up 7 | ||
685 | up 3 | ||
686 | forward 9 | ||
687 | forward 4 | ||
688 | down 8 | ||
689 | down 4 | ||
690 | forward 2 | ||
691 | down 8 | ||
692 | up 3 | ||
693 | forward 6 | ||
694 | forward 4 | ||
695 | down 2 | ||
696 | up 9 | ||
697 | down 5 | ||
698 | up 8 | ||
699 | up 6 | ||
700 | up 3 | ||
701 | down 2 | ||
702 | forward 6 | ||
703 | forward 4 | ||
704 | forward 7 | ||
705 | forward 2 | ||
706 | down 5 | ||
707 | down 2 | ||
708 | forward 2 | ||
709 | forward 6 | ||
710 | down 5 | ||
711 | down 4 | ||
712 | forward 8 | ||
713 | up 3 | ||
714 | forward 7 | ||
715 | down 1 | ||
716 | forward 5 | ||
717 | down 8 | ||
718 | down 9 | ||
719 | forward 5 | ||
720 | down 7 | ||
721 | forward 7 | ||
722 | up 6 | ||
723 | down 3 | ||
724 | forward 1 | ||
725 | down 2 | ||
726 | down 9 | ||
727 | down 2 | ||
728 | down 1 | ||
729 | forward 4 | ||
730 | up 5 | ||
731 | up 9 | ||
732 | forward 1 | ||
733 | down 5 | ||
734 | forward 4 | ||
735 | up 3 | ||
736 | up 5 | ||
737 | forward 7 | ||
738 | forward 5 | ||
739 | down 2 | ||
740 | down 8 | ||
741 | forward 5 | ||
742 | down 7 | ||
743 | up 8 | ||
744 | down 5 | ||
745 | down 6 | ||
746 | forward 8 | ||
747 | forward 9 | ||
748 | down 8 | ||
749 | up 3 | ||
750 | down 8 | ||
751 | down 2 | ||
752 | forward 8 | ||
753 | forward 8 | ||
754 | forward 4 | ||
755 | forward 9 | ||
756 | up 7 | ||
757 | up 1 | ||
758 | down 5 | ||
759 | down 8 | ||
760 | down 5 | ||
761 | forward 3 | ||
762 | forward 2 | ||
763 | down 8 | ||
764 | down 3 | ||
765 | down 2 | ||
766 | down 5 | ||
767 | forward 8 | ||
768 | up 3 | ||
769 | down 9 | ||
770 | up 4 | ||
771 | up 1 | ||
772 | up 8 | ||
773 | down 8 | ||
774 | forward 5 | ||
775 | down 2 | ||
776 | forward 4 | ||
777 | forward 1 | ||
778 | down 7 | ||
779 | forward 4 | ||
780 | forward 5 | ||
781 | up 2 | ||
782 | down 6 | ||
783 | up 9 | ||
784 | forward 1 | ||
785 | down 9 | ||
786 | forward 4 | ||
787 | down 7 | ||
788 | down 9 | ||
789 | up 9 | ||
790 | forward 2 | ||
791 | forward 7 | ||
792 | down 7 | ||
793 | forward 9 | ||
794 | forward 1 | ||
795 | forward 1 | ||
796 | down 7 | ||
797 | up 6 | ||
798 | up 3 | ||
799 | forward 2 | ||
800 | forward 6 | ||
801 | forward 9 | ||
802 | forward 3 | ||
803 | forward 4 | ||
804 | forward 9 | ||
805 | forward 9 | ||
806 | forward 9 | ||
807 | down 8 | ||
808 | up 2 | ||
809 | forward 7 | ||
810 | down 8 | ||
811 | down 3 | ||
812 | up 8 | ||
813 | down 8 | ||
814 | forward 1 | ||
815 | forward 9 | ||
816 | forward 2 | ||
817 | forward 3 | ||
818 | down 8 | ||
819 | forward 1 | ||
820 | forward 4 | ||
821 | down 9 | ||
822 | down 4 | ||
823 | up 7 | ||
824 | forward 5 | ||
825 | down 4 | ||
826 | forward 5 | ||
827 | down 2 | ||
828 | forward 6 | ||
829 | down 1 | ||
830 | up 9 | ||
831 | down 5 | ||
832 | up 5 | ||
833 | down 2 | ||
834 | up 1 | ||
835 | up 8 | ||
836 | down 3 | ||
837 | up 3 | ||
838 | down 8 | ||
839 | forward 4 | ||
840 | forward 1 | ||
841 | up 5 | ||
842 | forward 1 | ||
843 | down 5 | ||
844 | up 5 | ||
845 | forward 8 | ||
846 | down 1 | ||
847 | up 4 | ||
848 | forward 9 | ||
849 | forward 7 | ||
850 | up 1 | ||
851 | up 9 | ||
852 | forward 7 | ||
853 | forward 1 | ||
854 | up 5 | ||
855 | forward 6 | ||
856 | down 2 | ||
857 | up 5 | ||
858 | down 4 | ||
859 | down 6 | ||
860 | down 3 | ||
861 | forward 8 | ||
862 | down 7 | ||
863 | down 5 | ||
864 | down 7 | ||
865 | forward 1 | ||
866 | down 7 | ||
867 | up 5 | ||
868 | down 4 | ||
869 | down 4 | ||
870 | down 4 | ||
871 | forward 3 | ||
872 | forward 4 | ||
873 | up 6 | ||
874 | forward 8 | ||
875 | forward 2 | ||
876 | up 1 | ||
877 | forward 5 | ||
878 | forward 6 | ||
879 | forward 6 | ||
880 | up 2 | ||
881 | down 3 | ||
882 | forward 3 | ||
883 | up 8 | ||
884 | forward 6 | ||
885 | forward 5 | ||
886 | up 2 | ||
887 | up 5 | ||
888 | down 6 | ||
889 | down 8 | ||
890 | down 1 | ||
891 | forward 6 | ||
892 | down 3 | ||
893 | down 2 | ||
894 | forward 4 | ||
895 | down 4 | ||
896 | down 7 | ||
897 | forward 9 | ||
898 | forward 4 | ||
899 | forward 5 | ||
900 | down 8 | ||
901 | down 9 | ||
902 | up 4 | ||
903 | up 4 | ||
904 | down 5 | ||
905 | up 1 | ||
906 | up 6 | ||
907 | down 9 | ||
908 | forward 9 | ||
909 | forward 4 | ||
910 | forward 9 | ||
911 | forward 9 | ||
912 | down 5 | ||
913 | down 1 | ||
914 | up 9 | ||
915 | down 3 | ||
916 | up 5 | ||
917 | down 7 | ||
918 | forward 6 | ||
919 | forward 2 | ||
920 | down 5 | ||
921 | down 6 | ||
922 | forward 7 | ||
923 | forward 2 | ||
924 | up 9 | ||
925 | forward 6 | ||
926 | down 7 | ||
927 | up 4 | ||
928 | forward 1 | ||
929 | down 5 | ||
930 | forward 2 | ||
931 | forward 1 | ||
932 | down 6 | ||
933 | down 1 | ||
934 | down 4 | ||
935 | forward 8 | ||
936 | forward 1 | ||
937 | down 5 | ||
938 | down 8 | ||
939 | down 3 | ||
940 | forward 4 | ||
941 | down 2 | ||
942 | forward 9 | ||
943 | up 1 | ||
944 | forward 8 | ||
945 | down 4 | ||
946 | down 3 | ||
947 | down 1 | ||
948 | forward 5 | ||
949 | forward 9 | ||
950 | down 3 | ||
951 | forward 6 | ||
952 | up 6 | ||
953 | up 9 | ||
954 | forward 8 | ||
955 | forward 2 | ||
956 | down 9 | ||
957 | forward 3 | ||
958 | down 4 | ||
959 | down 5 | ||
960 | down 4 | ||
961 | forward 2 | ||
962 | forward 6 | ||
963 | down 9 | ||
964 | down 5 | ||
965 | forward 6 | ||
966 | forward 3 | ||
967 | forward 5 | ||
968 | forward 6 | ||
969 | forward 5 | ||
970 | forward 1 | ||
971 | up 4 | ||
972 | up 1 | ||
973 | down 2 | ||
974 | up 6 | ||
975 | down 5 | ||
976 | down 1 | ||
977 | forward 9 | ||
978 | down 1 | ||
979 | down 2 | ||
980 | forward 6 | ||
981 | up 2 | ||
982 | down 4 | ||
983 | up 3 | ||
984 | forward 8 | ||
985 | down 4 | ||
986 | down 4 | ||
987 | down 6 | ||
988 | up 1 | ||
989 | down 7 | ||
990 | up 4 | ||
991 | down 6 | ||
992 | up 7 | ||
993 | up 6 | ||
994 | down 5 | ||
995 | forward 3 | ||
996 | forward 4 | ||
997 | up 5 | ||
998 | down 2 | ||
999 | down 9 | ||
1000 | forward 9 | ||
diff --git a/2021/day2/input.example b/2021/day2/input.example new file mode 100644 index 0000000..b7172ac --- /dev/null +++ b/2021/day2/input.example | |||
@@ -0,0 +1,6 @@ | |||
1 | forward 5 | ||
2 | down 5 | ||
3 | forward 8 | ||
4 | up 3 | ||
5 | down 8 | ||
6 | forward 2 | ||
diff --git a/2021/day2/pilot.c b/2021/day2/pilot.c new file mode 100644 index 0000000..4268cc7 --- /dev/null +++ b/2021/day2/pilot.c | |||
@@ -0,0 +1,34 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <string.h> | ||
4 | |||
5 | int main(int argc, char *argv[]) | ||
6 | { | ||
7 | if (argc != 2) { | ||
8 | printf("Usage: ./depth <input-file>\n"); | ||
9 | exit(EXIT_FAILURE); | ||
10 | } | ||
11 | |||
12 | FILE *fp; | ||
13 | char *buffer; | ||
14 | ssize_t read; | ||
15 | size_t len = 0; | ||
16 | |||
17 | fp = fopen(argv[1], "r"); | ||
18 | if (fp == NULL) { | ||
19 | perror("fopen"); | ||
20 | exit(EXIT_FAILURE); | ||
21 | } | ||
22 | |||
23 | int scalar; | ||
24 | char *way; | ||
25 | while ((read = getline(&buffer, &len, fp)) != -1) { | ||
26 | sscanf(buffer, "%s %d", way, &scalar); | ||
27 | // printf("READ: <%s>, <%d>\n", way, scalar); | ||
28 | |||
29 | if (strncmp(buffer, "forward", strlen(buffer))) { | ||
30 | } | ||
31 | } | ||
32 | |||
33 | return 0; | ||
34 | } | ||