Page Not Found
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
commit 66462a1b7d91327f4dd3e0ac9ba0da62ccb3103c Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu Sep 7 17:53:23 2023 +0000 deploy: f0d5e17be72cb5853da24c530d98a5e7bc0072e8 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..10f54f9 --- /dev/null +++ b/404.html @@ -0,0 +1,25 @@ + + +
+ + +We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
Vec
",id:"indexing-vec",level:4},{value:"Issues",id:"issues",level:5},{value:"Checking bounds",id:"checking-bounds",level:4},{value:"Solution",id:"solution",level:3},{value:"Day 9: Rope Bridge",id:"day-9-rope-bridge",level:2},{value:"Solution",id:"solution-1",level:3},{value:"Day 10: Cathode-Ray Tube",id:"day-10-cathode-ray-tube",level:2},{value:"Solution",id:"solution-2",level:3},{value:"Day 11: Monkey in the Middle",id:"day-11-monkey-in-the-middle",level:2},{value:"Solution",id:"solution-3",level:3},{value:"Day 12: Hill Climbing Algorithm",id:"day-12-hill-climbing-algorithm",level:2},{value:"Solution",id:"solution-4",level:3},{value:"Day 13: Distress Signal",id:"day-13-distress-signal",level:2},{value:"Solution",id:"solution-5",level:3},{value:"Day 14: Regolith Reservoir",id:"day-14-regolith-reservoir",level:2},{value:"Solution",id:"solution-6",level:3},{value:"Post Mortem",id:"post-mortem",level:2},{value:"Indexing",id:"indexing",level:3},{value:"Cause of the problem",id:"cause-of-the-problem",level:4}],u={toc:p},d="wrapper";function m(e){let{components:t,...n}=e;return(0,i.kt)(d,(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Let's go through the second week of ",(0,i.kt)("a",{parentName:"p",href:"https://adventofcode.com"},(0,i.kt)("em",{parentName:"a"},"Advent of Code"))," in Rust."),(0,i.kt)("h2",{id:"day-8-treetop-tree-house"},(0,i.kt)("a",{parentName:"h2",href:"https://adventofcode.com/2022/day/8"},"Day 8: Treetop Tree House")),(0,i.kt)("admonition",{title:"tl;dr",type:"info"},(0,i.kt)("p",{parentName:"admonition"},"We get a forest and we want to know how many trees are visible from the outside.\nApart from that we want to find the best view.")),(0,i.kt)("p",null,"Nothing interesting. We are moving around 2D map though. And indexing can get a\nbit painful when doing so, let's refactor it a bit ;) During the preparation for\nthe AoC, I have written ",(0,i.kt)("inlineCode",{parentName:"p"},"Vector2D")," and now it's time to extend it with indexing\nof ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec")," of ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec"),"s. In my solution I was manipulating with indices in the following\nway:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"swapping them"),(0,i.kt)("li",{parentName:"ul"},"checking whether they are correct indices for the ",(0,i.kt)("inlineCode",{parentName:"li"},"Vec&str
",id:"converting-from-str",level:4},{value:"Converting to String
",id:"converting-to-string",level:4},{value:"Adjusting the code",id:"adjusting-the-code",level:4},{value:"Summary",id:"summary",level:2},{value:"Advent of Code",id:"advent-of-code",level:3},{value:"with Rust",id:"with-rust",level:3}],u={toc:p},m="wrapper";function d(e){let{components:t,...o}=e;return(0,i.kt)(m,(0,a.Z)({},u,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Let's go through the fourth week of ",(0,i.kt)("a",{parentName:"p",href:"https://adventofcode.com"},(0,i.kt)("em",{parentName:"a"},"Advent of Code"))," in Rust."),(0,i.kt)("h2",{id:"day-22-monkey-map"},(0,i.kt)("a",{parentName:"h2",href:"https://adventofcode.com/2022/day/22"},"Day 22: Monkey Map")),(0,i.kt)("admonition",{title:"tl;dr",type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Simulating a movement on a 2D map with given instructions. Map becomes a cube in\nthe 2nd part\u2026")),(0,i.kt)("admonition",{title:"Rant",type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This was the most obnoxious problem of this year\u2026 and a lot of Rust issues have\nbeen hit.")),(0,i.kt)("h3",{id:"solution"},"Solution"),(0,i.kt)("p",null,"It seems like a very simple problem to solve, but with very obnoxious changes in\nthe 2nd part and also it's relatively hard to decompose \xbbproperly\xab."),(0,i.kt)("h4",{id:"column-iterator"},"Column iterator"),(0,i.kt)("p",null,"In the first part of the problem it was needed to know the boundaries of each\nrow and column, since I stored them in ",(0,i.kt)("inlineCode",{parentName:"p"},"Vec