{"id":1062,"date":"2023-12-05T19:22:24","date_gmt":"2023-12-05T17:22:24","guid":{"rendered":"https:\/\/www.juustila.com\/antti\/?p=1062"},"modified":"2023-12-05T19:25:05","modified_gmt":"2023-12-05T17:25:05","slug":"advent-of-code-hanging-on-so-far","status":"publish","type":"post","link":"https:\/\/www.juustila.com\/antti\/2023\/12\/05\/advent-of-code-hanging-on-so-far\/","title":{"rendered":"Advent of Code &#8211; hanging on, so far"},"content":{"rendered":"\n<p>I&#8217;ve solved all the puzzles by now, both part 1 and 2. Some have been quite tricky to solve. Other issues I&#8217;ve had &#8212; mainly stupid parsing problems.<\/p>\n\n\n\n<p>Having an effective parser would be something that helps. Also, as someone suggested in the Swift forums, a (generic) grid would help since apparently many puzzles have a grid to navigate.<\/p>\n\n\n\n<p>Already today I thought that the puzzle could be done using a graph. Went for maps (dictionaries) and arrays again, though. Unfortunately all my graph implementations I could reuse are either in Java or C++, and I&#8217;ve been doing everything so far in Swift. Maybe I&#8217;ll prepare a Graph struct\/class in Swift just to be ready when it is needed&#8230;.<\/p>\n\n\n\n<p>Today&#8217;s part 2 was hard in a sense that the solution took almost eight minutes to run on my Mac Mini M1. Surely there should be a way to optimise. But &#8212; won&#8217;t do that, I already passed the challenge. I still am busy with teaching, so all these puzzles are done on extra time.<\/p>\n\n\n\n<p>Anyways, today I rose to position 16 on private AoC Swift leaderboard. Even though I am not competing and skipping a day or failing a puzzle is no issue to me, it is nice to see that I do relatively well &#8211; so far&#8230; <\/p>\n\n\n\n<p>By now I&#8217;ve used Sets, Dictionaries, arrays, ranges, string manipulation, string splitting, enumerations, and those grid operations. Let&#8217;s see what comes up tomorrow&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve solved all the puzzles by now, both part 1 and 2. Some have been quite tricky to solve. Other issues I&#8217;ve had &#8212; mainly stupid parsing problems. Having an effective parser would be something that helps. Also, as someone suggested in the Swift forums, a (generic) grid would help since apparently many puzzles have &hellip; <a href=\"https:\/\/www.juustila.com\/antti\/2023\/12\/05\/advent-of-code-hanging-on-so-far\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Advent of Code &#8211; hanging on, so far&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[2],"tags":[136,48,137,39,70,46],"class_list":["post-1062","post","type-post","status-publish","format-standard","hentry","category-coding","tag-advent-of-code","tag-algorithms","tag-aoc","tag-performance","tag-programming","tag-swift"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/posts\/1062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/comments?post=1062"}],"version-history":[{"count":1,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/posts\/1062\/revisions"}],"predecessor-version":[{"id":1063,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/posts\/1062\/revisions\/1063"}],"wp:attachment":[{"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/media?parent=1062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/categories?post=1062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/tags?post=1062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}