From cdc79643bea0a7687ae3699f203b2ecf9a969e74 Mon Sep 17 00:00:00 2001 From: Lennart ten Wolde Date: Sat, 17 Dec 2022 20:09:45 +0100 Subject: [PATCH] Day 4 --- day_01/{day_01.nim => solve.nim} | 0 day_02/{day_02.nim => solve.nim} | 0 day_04/input.txt | 1000 ++++++++++++++++++++++++++++++ day_04/solve.nim | 43 ++ make_day.sh | 3 +- run_day.sh | 3 + template.nim | 2 +- 7 files changed, 1049 insertions(+), 2 deletions(-) rename day_01/{day_01.nim => solve.nim} (100%) rename day_02/{day_02.nim => solve.nim} (100%) create mode 100644 day_04/input.txt create mode 100644 day_04/solve.nim create mode 100755 run_day.sh diff --git a/day_01/day_01.nim b/day_01/solve.nim similarity index 100% rename from day_01/day_01.nim rename to day_01/solve.nim diff --git a/day_02/day_02.nim b/day_02/solve.nim similarity index 100% rename from day_02/day_02.nim rename to day_02/solve.nim diff --git a/day_04/input.txt b/day_04/input.txt new file mode 100644 index 0000000..03e097b --- /dev/null +++ b/day_04/input.txt @@ -0,0 +1,1000 @@ +21-81,20-96 +14-80,14-79 +87-89,7-88 +82-93,44-82 +61-93,62-86 +80-94,4-80 +66-90,89-91 +9-70,10-10 +95-97,26-96 +82-87,61-88 +10-75,11-74 +29-95,14-96 +6-47,41-48 +29-75,28-28 +18-74,1-17 +10-89,52-89 +68-68,27-67 +56-96,11-56 +3-10,11-99 +25-46,11-47 +3-95,96-96 +14-38,37-38 +6-89,5-49 +14-76,7-76 +26-94,26-98 +2-89,3-90 +56-76,55-77 +1-98,2-99 +16-59,16-17 +18-97,27-97 +74-79,75-78 +21-83,21-84 +56-65,63-73 +22-56,22-55 +21-96,22-94 +7-89,7-88 +19-57,53-56 +11-45,10-12 +5-74,3-73 +63-85,77-84 +2-91,1-84 +20-79,21-80 +76-95,77-96 +23-23,2-23 +3-3,4-98 +4-67,17-66 +26-61,25-91 +1-1,2-87 +4-92,4-99 +13-98,8-13 +31-74,38-73 +9-39,38-39 +63-74,62-74 +65-91,9-64 +1-85,1-86 +14-22,23-23 +19-78,79-79 +24-42,25-41 +10-54,9-9 +6-96,3-4 +39-97,38-38 +48-58,59-77 +13-13,14-22 +97-98,3-98 +10-92,9-9 +69-71,77-90 +1-99,99-99 +24-25,25-82 +8-92,3-8 +20-91,19-98 +34-89,90-90 +56-56,56-95 +16-17,17-80 +13-97,10-99 +10-98,10-88 +13-76,76-77 +8-70,15-69 +15-95,95-95 +21-37,27-36 +53-64,7-52 +15-84,34-84 +60-60,17-60 +5-94,2-3 +1-1,2-90 +68-70,70-97 +62-64,4-63 +6-97,5-98 +77-90,73-77 +21-22,22-23 +91-97,96-97 +11-96,12-28 +42-63,42-62 +31-73,14-81 +72-72,4-71 +10-75,9-76 +7-7,8-89 +51-96,52-97 +23-32,5-33 +2-82,2-83 +1-99,91-98 +6-95,7-94 +16-63,16-17 +65-95,99-99 +3-98,56-97 +82-84,1-83 +89-89,67-88 +37-70,95-97 +33-34,4-33 +4-92,63-92 +3-88,2-88 +14-93,13-13 +34-36,35-70 +10-32,31-75 +8-38,7-38 +43-54,43-62 +6-8,7-14 +5-99,1-98 +29-52,51-52 +12-58,44-84 +18-96,19-35 +19-37,18-20 +2-3,3-3 +1-55,1-56 +94-97,20-75 +44-86,98-98 +20-61,88-92 +28-92,13-78 +49-95,50-50 +18-62,61-63 +47-81,46-82 +12-59,12-60 +77-77,27-77 +6-91,5-64 +87-87,1-86 +6-23,6-22 +13-99,13-98 +69-98,13-96 +3-68,2-95 +28-87,31-88 +26-91,25-94 +6-78,31-77 +12-85,12-69 +25-27,26-26 +60-60,11-60 +18-97,1-96 +3-96,2-95 +1-95,2-93 +17-49,34-68 +3-56,1-4 +2-99,25-97 +4-80,2-5 +6-79,10-87 +16-18,14-21 +42-79,80-80 +20-59,21-58 +98-99,75-99 +55-73,24-74 +10-93,9-11 +65-80,64-79 +39-96,11-39 +31-96,31-76 +2-94,1-3 +7-29,91-96 +20-53,18-20 +47-68,32-48 +4-13,14-28 +49-56,18-57 +55-65,65-73 +27-64,65-83 +40-40,16-40 +48-67,40-48 +24-91,43-92 +16-68,36-69 +2-2,1-50 +5-8,7-47 +40-88,2-40 +40-90,40-40 +11-62,12-68 +16-69,15-80 +19-71,70-94 +9-79,9-80 +17-96,97-97 +23-97,23-99 +25-25,13-25 +33-40,32-39 +58-60,14-59 +3-59,2-2 +34-40,35-35 +35-35,29-34 +16-87,17-88 +16-26,42-84 +26-68,25-26 +36-82,37-90 +20-20,20-20 +5-26,10-25 +22-52,6-23 +18-97,97-97 +5-51,6-6 +37-53,24-87 +13-18,18-24 +67-95,80-86 +2-14,13-42 +40-70,9-63 +14-54,14-53 +3-7,3-6 +11-42,16-93 +1-97,21-87 +67-74,68-72 +20-98,19-98 +18-33,29-33 +48-94,95-95 +72-92,46-77 +16-92,92-94 +44-46,45-75 +34-94,94-94 +31-80,80-80 +10-31,32-99 +6-41,15-42 +20-20,19-77 +12-95,7-9 +35-36,2-38 +10-21,9-9 +10-58,11-11 +16-37,17-37 +69-73,29-69 +82-86,41-85 +71-93,72-85 +44-82,43-98 +40-96,23-96 +12-97,12-96 +86-88,10-97 +54-81,80-81 +9-19,9-71 +32-83,83-84 +32-89,31-98 +60-84,60-83 +92-93,7-93 +17-99,17-97 +19-49,19-48 +24-48,45-47 +6-40,7-39 +6-89,6-67 +83-88,82-88 +3-98,3-99 +4-4,3-92 +4-41,40-95 +53-87,88-88 +63-65,61-64 +7-73,7-7 +25-25,26-47 +31-98,50-99 +32-96,27-33 +55-57,34-56 +1-9,9-97 +20-72,7-20 +6-6,5-59 +28-44,43-45 +97-97,14-96 +69-69,47-68 +39-40,39-54 +19-49,47-67 +54-96,29-53 +79-96,64-80 +52-70,53-63 +17-90,17-57 +12-28,27-36 +23-76,94-98 +46-53,47-47 +31-57,30-89 +14-57,37-45 +2-99,1-99 +92-93,92-93 +5-92,5-83 +20-97,74-98 +14-27,27-80 +2-74,2-98 +24-35,34-45 +47-48,13-48 +29-71,26-71 +39-39,40-69 +2-50,49-51 +29-47,26-32 +12-48,11-11 +1-64,2-63 +16-63,6-16 +12-89,89-89 +37-63,38-62 +8-54,6-8 +1-98,4-95 +28-76,69-83 +5-79,6-80 +6-6,7-96 +16-80,16-16 +48-96,49-91 +17-90,18-90 +22-27,27-27 +72-90,67-91 +7-7,8-89 +90-93,36-90 +70-72,53-73 +14-91,15-92 +31-99,98-99 +31-68,30-95 +43-74,42-98 +23-32,28-34 +19-19,18-54 +15-15,6-15 +24-81,25-25 +9-85,8-85 +3-56,55-77 +16-96,17-18 +10-95,96-96 +4-5,8-15 +11-81,12-80 +43-43,42-48 +12-28,27-85 +33-33,28-33 +2-2,3-97 +85-85,57-84 +12-94,95-98 +26-28,27-67 +35-51,34-51 +12-36,36-36 +31-35,32-44 +1-2,3-89 +13-72,12-75 +2-59,2-58 +10-85,84-86 +38-95,45-59 +8-93,93-93 +97-98,9-98 +17-92,5-9 +34-87,89-92 +24-43,44-63 +3-99,1-3 +26-64,27-64 +41-41,40-85 +33-82,4-34 +10-98,99-99 +1-83,2-84 +55-91,55-86 +2-13,7-32 +3-3,2-76 +73-92,9-73 +3-6,5-7 +10-44,14-43 +10-89,9-11 +74-76,17-75 +8-11,1-11 +50-58,97-97 +66-86,65-65 +5-68,69-69 +5-5,6-59 +2-14,8-93 +36-91,97-97 +55-74,74-84 +41-84,40-91 +16-75,6-76 +17-85,88-94 +27-33,32-34 +63-64,4-64 +27-93,27-92 +31-78,30-77 +16-37,43-87 +14-94,14-71 +24-98,23-24 +19-94,95-95 +98-98,53-76 +9-86,2-10 +53-53,34-52 +34-42,34-36 +26-91,24-90 +90-96,90-95 +11-88,12-50 +45-81,31-44 +6-38,5-39 +35-51,34-50 +54-68,68-95 +16-70,6-10 +29-81,82-82 +20-93,34-94 +50-97,84-97 +92-98,53-68 +44-52,43-52 +15-96,27-97 +47-47,46-63 +54-90,53-53 +20-55,20-56 +5-74,30-75 +2-64,7-65 +7-83,8-82 +45-49,14-59 +1-74,12-75 +10-98,11-98 +26-99,25-89 +28-99,29-29 +23-65,22-91 +7-7,6-10 +22-46,42-50 +25-67,67-79 +42-81,32-82 +35-96,34-35 +1-99,99-99 +7-40,8-41 +43-62,44-93 +82-82,6-81 +74-99,7-73 +5-87,6-6 +44-80,4-81 +24-30,56-71 +33-60,32-60 +11-78,1-79 +6-41,6-6 +51-55,52-54 +49-51,42-50 +47-60,19-47 +46-81,47-96 +16-75,16-76 +35-43,43-96 +90-97,17-89 +92-94,31-91 +37-59,21-37 +2-94,6-95 +11-66,11-65 +4-65,2-62 +30-72,71-72 +16-61,61-61 +6-89,26-88 +28-94,94-94 +20-58,20-59 +18-92,94-98 +88-88,89-98 +23-70,23-71 +20-81,20-80 +57-88,14-95 +1-99,2-98 +52-98,21-52 +88-88,5-87 +94-97,87-87 +42-52,43-49 +14-75,15-76 +2-84,37-84 +52-57,49-62 +2-69,3-70 +9-13,13-85 +56-98,57-93 +42-92,29-54 +68-96,67-95 +20-64,19-19 +86-94,65-87 +27-45,46-46 +11-11,11-49 +8-95,16-95 +61-69,62-78 +32-97,32-98 +55-91,28-91 +11-98,12-97 +14-17,19-93 +10-81,54-80 +1-92,17-80 +27-90,28-39 +89-89,4-88 +29-30,21-30 +2-93,94-94 +23-50,24-34 +5-87,18-87 +32-41,33-36 +13-30,13-44 +39-44,38-45 +9-22,8-62 +78-87,32-78 +63-91,63-70 +5-51,45-53 +66-67,24-67 +20-20,20-72 +59-60,6-60 +7-93,8-76 +59-87,32-58 +52-94,53-53 +15-36,36-53 +23-82,6-14 +15-67,5-14 +30-60,30-30 +5-55,32-56 +48-72,6-49 +1-88,20-88 +8-97,9-98 +18-46,17-27 +69-80,81-81 +19-93,21-38 +17-59,58-60 +47-55,40-48 +23-91,91-96 +2-2,1-99 +14-89,89-89 +72-74,28-71 +99-99,2-98 +10-98,7-10 +8-99,9-98 +5-13,12-80 +92-99,1-93 +49-62,50-50 +11-50,11-49 +12-84,5-85 +11-81,9-81 +10-38,10-39 +18-71,14-94 +30-99,98-99 +5-95,3-4 +45-93,28-94 +38-63,39-64 +9-81,6-82 +37-90,58-89 +58-88,60-88 +73-95,33-54 +10-96,11-18 +5-27,4-26 +19-67,20-66 +10-29,9-37 +34-39,32-39 +3-10,10-71 +4-69,6-70 +47-47,48-58 +5-76,96-99 +3-98,4-97 +95-95,4-94 +52-53,47-53 +44-63,11-44 +69-86,60-85 +16-86,15-98 +5-99,6-99 +10-97,97-99 +89-89,4-88 +9-51,52-81 +54-86,54-55 +1-41,2-40 +66-96,16-65 +51-76,76-76 +89-89,89-89 +29-77,30-78 +28-93,27-92 +36-78,90-99 +83-83,84-96 +21-89,89-91 +16-70,8-16 +3-13,5-13 +51-92,11-92 +2-89,1-1 +5-96,2-96 +7-98,99-99 +8-29,1-30 +17-97,17-98 +72-78,53-71 +21-21,22-46 +2-93,7-93 +21-91,21-90 +69-73,30-74 +1-41,4-40 +1-97,1-98 +26-74,25-27 +4-27,26-99 +39-42,38-58 +18-74,6-11 +78-79,65-79 +27-44,45-92 +3-91,1-91 +13-96,14-92 +71-81,78-82 +4-85,27-84 +92-93,11-93 +46-59,46-58 +4-96,1-96 +5-84,6-54 +41-52,42-49 +35-92,66-93 +13-96,13-94 +4-90,1-30 +16-18,17-85 +90-92,46-90 +46-48,47-68 +60-93,42-92 +23-64,64-64 +5-35,24-36 +22-90,21-99 +93-93,90-94 +7-70,64-94 +4-4,5-96 +11-70,5-78 +9-30,7-8 +4-99,45-64 +7-49,7-50 +96-99,64-96 +34-36,35-84 +90-92,21-91 +3-4,5-89 +13-13,12-77 +17-54,20-55 +46-76,76-88 +6-91,90-91 +20-38,5-19 +43-80,22-79 +4-98,97-97 +65-80,71-79 +46-92,13-92 +9-79,9-19 +2-98,2-99 +18-20,21-52 +29-55,54-69 +17-17,16-16 +77-88,24-84 +24-28,22-27 +9-84,84-84 +13-99,13-98 +34-70,69-71 +71-98,98-98 +69-80,69-88 +8-18,18-18 +23-78,79-79 +27-62,28-28 +63-77,41-66 +6-96,7-95 +15-71,23-70 +24-64,20-64 +56-83,13-56 +38-66,37-96 +2-42,1-2 +34-74,64-73 +45-76,45-50 +3-44,1-2 +68-94,68-68 +4-68,69-69 +20-96,96-99 +3-98,1-99 +13-22,23-44 +21-34,26-35 +3-98,4-97 +1-3,4-58 +95-95,74-95 +1-93,1-92 +54-55,22-55 +8-20,7-37 +23-47,16-81 +12-78,13-77 +49-60,50-55 +43-98,64-97 +9-99,9-64 +80-85,53-82 +64-90,13-64 +45-88,33-59 +45-81,46-46 +18-72,18-77 +43-43,44-45 +46-76,77-77 +6-14,13-97 +29-89,7-90 +53-95,7-54 +71-71,71-92 +67-83,84-88 +1-95,96-97 +16-96,8-15 +27-77,77-92 +6-58,5-59 +50-85,51-57 +83-84,36-83 +66-80,53-75 +80-80,60-79 +4-91,4-28 +56-70,30-69 +34-52,36-52 +20-87,86-88 +25-44,40-44 +58-87,8-59 +31-92,31-93 +4-54,4-71 +8-57,18-57 +11-46,47-47 +36-49,30-50 +3-86,1-15 +2-78,3-77 +82-82,4-82 +22-98,2-21 +55-75,42-75 +30-82,46-83 +63-93,64-94 +50-50,19-50 +80-92,79-79 +8-16,7-60 +47-87,14-46 +14-24,24-70 +54-87,55-55 +7-48,6-6 +47-48,40-48 +12-63,63-63 +17-18,18-32 +32-90,44-85 +14-69,6-92 +29-82,18-29 +1-79,18-78 +11-81,5-10 +5-8,9-79 +4-98,5-5 +36-96,94-97 +12-64,26-63 +28-84,27-28 +11-89,11-88 +31-55,52-54 +3-25,3-55 +76-85,75-91 +23-82,49-93 +24-38,17-38 +56-94,67-93 +10-51,23-52 +24-77,12-76 +54-60,56-59 +25-28,28-28 +49-75,57-74 +10-69,5-7 +45-54,24-49 +11-34,26-33 +29-95,29-99 +9-66,9-87 +3-61,54-62 +46-96,43-68 +9-58,10-78 +22-96,95-96 +2-35,3-34 +3-94,4-95 +78-84,79-85 +93-94,15-94 +23-23,24-89 +13-94,12-94 +4-81,2-80 +6-99,17-99 +26-63,16-63 +8-10,7-13 +23-85,85-85 +70-98,69-99 +26-44,41-43 +17-97,16-97 +62-98,99-99 +46-88,78-87 +18-71,4-18 +96-96,75-96 +37-87,5-86 +14-31,26-30 +23-52,23-75 +16-94,17-17 +50-50,50-50 +9-12,12-98 +98-99,24-99 +7-14,13-55 +14-76,9-76 +11-81,8-82 +89-89,3-89 +13-90,14-84 +7-86,86-86 +2-8,7-50 +11-98,11-99 +13-96,96-96 +5-8,8-50 +10-54,11-53 +6-75,7-72 +50-51,15-51 +7-37,9-37 +34-35,18-61 +11-76,10-84 +4-62,1-3 +1-87,20-84 +7-83,8-87 +5-14,7-51 +56-58,10-57 +2-2,3-92 +56-68,37-85 +57-57,52-56 +40-79,78-79 +73-74,4-74 +8-98,99-99 +76-76,70-77 +79-94,66-78 +10-68,11-65 +10-24,23-42 +82-83,46-83 +54-92,55-91 +7-17,18-60 +50-80,58-81 +75-77,76-76 +1-99,2-55 +91-91,12-91 +1-90,89-91 +22-23,21-42 +80-80,31-80 +6-6,5-20 +34-47,34-78 +2-95,2-99 +30-65,62-65 +10-69,68-70 +8-29,23-43 +37-47,36-49 +62-63,48-63 +21-97,3-97 +25-75,22-25 +92-92,14-92 +94-96,12-94 +1-80,1-81 +27-32,31-33 +26-59,25-88 +86-92,38-86 +34-42,35-41 +58-91,57-95 +62-62,5-62 +3-46,47-73 +13-97,10-37 +9-39,3-10 +55-89,55-81 +41-88,40-40 +22-87,5-88 +78-94,30-78 +86-86,85-86 +5-62,11-90 +46-56,47-55 +4-12,11-92 +99-99,14-98 +9-30,8-80 +43-43,42-45 +53-56,40-56 +3-97,2-97 +13-32,12-95 +10-91,11-92 +86-98,59-87 +6-81,82-82 +24-84,85-87 +39-86,40-40 +31-54,53-75 +7-98,4-87 +70-75,72-74 +29-87,28-98 +26-91,25-25 +12-57,13-56 +19-87,86-88 +9-15,10-16 +12-50,45-65 +53-64,64-64 +90-91,4-91 +2-85,22-85 +13-13,14-87 +30-51,28-29 +17-67,16-93 +14-70,23-68 +65-72,60-71 +5-77,1-78 +10-15,4-11 +2-63,62-64 +4-91,4-80 +24-60,8-59 +1-99,75-98 +11-86,85-86 +16-18,17-91 +50-76,76-78 +54-58,57-59 +13-64,64-70 +15-21,14-25 +23-25,9-24 +40-67,41-68 +16-18,17-95 +59-83,82-83 +45-99,17-42 +8-30,31-75 +1-98,97-98 +2-78,2-77 +19-57,18-19 +25-73,25-59 +21-98,21-95 +14-70,15-54 +81-83,67-82 +1-99,93-98 +8-35,35-83 +2-83,2-84 +7-96,6-99 +11-63,11-64 +46-80,17-94 +4-61,3-62 +54-97,55-97 +73-73,21-73 +6-66,65-67 +56-89,61-88 +42-53,41-70 +5-46,5-45 +46-92,20-91 +93-96,15-93 +57-64,52-65 +28-28,27-87 +8-47,2-7 +31-31,32-33 +1-99,2-97 +12-84,83-84 +3-14,15-90 +8-8,8-64 +35-85,14-36 +83-99,58-98 +4-93,3-99 +26-77,18-27 +1-83,21-27 +95-95,16-94 +5-66,6-27 +66-84,21-78 +40-85,43-86 +19-75,12-19 +11-96,1-10 +40-53,20-40 +29-57,45-79 +36-75,35-35 +10-10,5-10 +62-78,70-77 +2-95,11-94 +37-37,36-89 +5-15,1-19 +73-96,82-96 +27-27,26-82 +91-93,27-92 +62-74,21-62 +29-35,36-85 +29-33,28-96 +60-92,26-61 +1-86,1-86 +6-8,9-44 +3-68,25-67 +2-12,13-32 +3-71,72-72 +47-93,14-47 +34-88,60-95 +6-28,28-93 +37-62,33-38 +8-93,8-92 +9-15,15-77 +38-44,39-39 +5-88,4-4 +17-94,16-18 +84-84,7-83 +1-4,4-29 +27-80,12-79 +3-78,78-78 +76-79,75-77 +2-94,96-98 +30-57,20-30 +6-26,27-97 +22-76,21-21 +8-42,9-23 +31-39,38-40 +34-35,5-35 +77-80,76-80 +12-92,11-94 +47-51,12-47 +90-93,37-90 +96-97,12-93 +10-93,1-9 +4-10,3-19 +59-82,60-81 +11-39,10-10 +58-72,59-69 +71-71,70-70 +69-71,71-72 +94-96,4-95 +14-83,5-84 +1-59,12-58 +20-99,98-99 +43-43,42-88 +99-99,51-99 +12-21,11-20 +47-48,22-48 +9-37,9-38 +24-60,24-74 +94-94,2-94 +57-57,58-90 +67-89,66-93 +1-54,11-88 +4-11,12-12 +60-99,60-98 +45-59,53-59 +4-4,3-84 +9-80,8-81 +13-45,14-74 +84-86,73-85 +45-79,44-78 +9-16,9-18 +84-93,93-93 +70-80,71-81 +66-91,39-92 +26-26,27-96 +16-35,35-35 +62-62,62-97 +18-93,19-92 +94-96,64-94 +5-98,2-5 +96-96,95-98 +7-65,2-7 +3-87,4-4 +26-79,56-80 +7-78,7-63 +7-96,3-8 +28-96,28-28 \ No newline at end of file diff --git a/day_04/solve.nim b/day_04/solve.nim new file mode 100644 index 0000000..7103951 --- /dev/null +++ b/day_04/solve.nim @@ -0,0 +1,43 @@ +import std/[strutils, sequtils, sugar] + +type Assignment = object + first: int + last: int + +proc assignment(sections: string): Assignment {.inline.} = + let edges = sections.split("-") + return Assignment(first: edges[0].parseInt, last: edges[1].parseInt) + +proc contains(self: Assignment, other: Assignment): bool {.inline.} = + other.first >= self.first and other.last <= self.last + +proc intersects(self: Assignment, other: Assignment): bool {.inline.} = + other.last >= self.first and other.first <= self.last + +const input = readFile("day_04/input.txt") + +iterator elfPairs(data: string): tuple[elf1: Assignment, elf2: Assignment] = + for pair in input.splitLines: + let assignments = pair.split(",") + yield ( + elf1: assignment(assignments[0]), + elf2: assignment(assignments[1]) + ) + +proc solvePart1() = + var count = 0 + for pair in input.elfPairs: + if pair.elf1.contains(pair.elf2) or pair.elf2.contains(pair.elf1): + count += 1 + echo "Fully incuded pairs: " & $count + +proc solvePart2() = + var count = 0 + for pair in input.elfPairs: + if pair.elf1.intersects(pair.elf2): + count += 1 + echo "Intersecting pairs: " & $count + +if isMainModule: + solvePart1() + solvePart2() diff --git a/make_day.sh b/make_day.sh index 382b853..52198bd 100755 --- a/make_day.sh +++ b/make_day.sh @@ -2,5 +2,6 @@ echo "Making day_$1" mkdir day_$1 -cp template.nim day_$1 +cp template.nim day_$1/solve.nim +sed -i "s/DAYNR/$1/g" day_$1/solve.nim touch day_$1/input.txt diff --git a/run_day.sh b/run_day.sh new file mode 100755 index 0000000..9faa1ee --- /dev/null +++ b/run_day.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +nim c -r day_$1/solve.nim \ No newline at end of file diff --git a/template.nim b/template.nim index 74a0938..aeb454f 100644 --- a/template.nim +++ b/template.nim @@ -1,6 +1,6 @@ import std/[] -const input = readFile("input.txt") +const input = readFile("day_DAYNR/input.txt") proc solvePart1() = echo "TODO"