Rust Finally Betrayed Me (Coding in a Random Language Every Day)

Поделиться
HTML-код
  • Опубликовано: 19 дек 2024

Комментарии •

  • @queueue_
    @queueue_ Год назад +414

    "It's gonna work but it's disgusting" -My exact thoughts while working on my own solution

    • @alexander53
      @alexander53 Год назад +13

      My exact thoughts working on v0 of anything I've ever written

    • @GaymerJenn
      @GaymerJenn Год назад +5

      Yep, same lol. I hate working with multidimensional arrays.

  • @chefaku
    @chefaku Год назад +195

    "Unnecessary parentheses around 'if' condition"

    • @LowLevelTV
      @LowLevelTV  Год назад +119

      I will not be silenced.

    • @ninetysixvoid
      @ninetysixvoid Год назад +7

      didnt ask + dont care + ratio

    • @ecranfortessa
      @ecranfortessa Год назад +7

      @@ninetysixvoid Ratio failed, lulz.

    • @IonicMC
      @IonicMC 11 месяцев назад

      ​@@LowLevelTV Lmao

  • @siddharthbisht8522
    @siddharthbisht8522 Год назад +225

    Took me 2.5 hours for both the stars. 90% of time was trying to make my logic work in rust and rest 10% was me contemplating if I should just use python

    • @Reydriel
      @Reydriel Год назад +15

      Would Python make the algorithm any less of a pain to write? I feel like this question was very intentionally made to be very annoying with its edge cases lol

    • @siddharthbisht8522
      @siddharthbisht8522 Год назад +4

      @@Reydriel for me personally algorithm was not that hard to make within the first 2 minutes I knew what I wanted to do with small modifications here and there along the way ( And in no way am I a good CP I am pretty sure my logic would be doo doo water for any decent CP ) but the fact that I have just started with the rust lang. But in the end it was fun.

    • @ficolas2
      @ficolas2 Год назад +4

      More or less the same, 1:50h for me, failed the first time I submitted because of an off by one error.
      Most of the time was struggling with rust (learning it with this year AoC, I have read through like 1/3rd of the rust book before this) and struggling with neovim (also learning it with this year AoC, I have been using vim motions for months tho)
      I much prefer my solution to LLL's, however the second part is super slow, takes like half a second to run, because the time complexity is ass, plus I used regex to find the numbers. However conceptually is super simple.

    • @siddharthbisht8522
      @siddharthbisht8522 Год назад

      @@ficolas2 I too want to learn vim (neovim) but just cant stand it. Tried for the first time last week but couldn't figure out how to move away from the terminal window and focus on the editor without using the mouse lol. Maybe if I can find someone who will instantly help me out for the first few weeks until I develop some basic knowledge then I will happily move away from my vscode haha

    • @ficolas2
      @ficolas2 Год назад

      @@siddharthbisht8522 I would really recommend doing what I did. First use vimMotions in vscode (or ideavim in intelliJ), and get used to it, before moving to neovim. Otherwise it is so overwhelming.
      I watched the primeagen's videos on vim motions, and now I can't live without them. Sometimes I am writing something in a Google docs and attempt to do some vim shenanigans...

  • @combatcorgiofficial
    @combatcorgiofficial Год назад +70

    How it started: *rust copium*
    How it went: “This is disgusting” “the classic off by one error” (lol, lmao even, rust safety go brrrr)
    It’s beautiful, brings a tear to my eye. Rust culture aside, solid video homie

    • @warmwaffles
      @warmwaffles Год назад +1

      It was fun watching the pain and the sudden realization it was right.

  • @scheimong
    @scheimong Год назад +97

    Even when you write Rust, your code style is still so similar to C.

    • @ctleans6326
      @ctleans6326 Год назад +11

      Clippy throws a fit every other line

  • @teakivy
    @teakivy Год назад +40

    Love this idea since day 1, i'm doing something similar where each weekday is a different (set) language, so
    Monday - PHP (never touched before and am scared for tomorrow)
    Tuesday - Pyhon
    Wednesday - Rust (just started learning)
    Thursday - C# (havent used in years)
    Friday - Java
    Saturday - C++ (barely used)
    Sunday - Typescript

    • @AlLiberali
      @AlLiberali Год назад +1

      I'd argue that php is a better lang than snake. Worry not and embrace the $

    • @miezekatze3536
      @miezekatze3536 Год назад +1

      I created a list where I chose random languages from each day and got "Haskell, nim, Fortran"... Haskell was by far the easiest to work with

  • @TimBielawa
    @TimBielawa Год назад +25

    Chat please get AWK on the list next time

  • @kainoa82858
    @kainoa82858 Год назад +138

    Can't wait to see the final episode ended off with Malbolge, where the solution takes until next christmas to find!

    • @miezekatze3536
      @miezekatze3536 Год назад +13

      I don't think anyone is *that* good to finish it in a single year

    • @informagico6331
      @informagico6331 Год назад +3

      I think we all agree to select Malbolge whenever the RUclips chat obtains the privilege to vote

    • @bjerrum4921
      @bjerrum4921 Год назад +1

      haha funny impossible to read language

    • @sinom
      @sinom Год назад +2

      You can by now algorithmically construct malbolge programs. They will be nowhere near optimal but they will work.

  • @mully006
    @mully006 Год назад +95

    I think you need to add COBOL to the wheel.

  • @simplicity5830
    @simplicity5830 Год назад +4

    I spent a long time on this, and the whole time thinking "I must be so stupid"... Then I watch this and find I did almost the same logic in my solutions, one with and one without Regex.
    Thanks for making me not feel stupid, that a programmer magnitudes much better and more experienced than me didn't have a solution that to me is unintelligeable. :)

  • @ErikaKuykendall
    @ErikaKuykendall Год назад +8

    I approached this one as an axis aligned bounding box collision detection problem - just treat every symbol as a 3x3 box centered at the symbol, find what collides with it.

    • @rezwhap
      @rezwhap Год назад +1

      Nice. In part 1, how did you prevent double-counting if a number is adjacent to two symbols?

    • @anarchymatt
      @anarchymatt Год назад

      Do a uniqueness check on the x and y coordinate of the first character of the number
      Use a set

  • @rotellam
    @rotellam Год назад +1

    Really glad it wasn't just me! My algorithm was similar; I read the array left to right, top to bottom and when it found a digit started reading that into a buffer until there wasn't any more digits while keeping track of x and y for those digits, then checked if there was any symbols around it (previous line, before and after, next line). To avoid index issues in the array I added a line of dots to the beginning and end and a dot at the start and end of each line. That worked fine, but I found the second star much harder. I did the same thing but only recorded if there was a * around the number, then walked in a circle around the * to look for a second number, and assumed there was no duplicate two numbers in the array.

  • @reed6514
    @reed6514 Год назад +29

    I looped over chars ,and each time i encountered a digit, i searched around the digit for a symbol & marked the cur_num as valid if yes.
    Part2 was similar. For each *, searched around, then found the start of any number & kept an array of start-positions to prevent duplicates.

    • @LowLevelTV
      @LowLevelTV  Год назад +13

      OH MY GOD THATS SO MUCH BETTER

    • @KingJellyfishII
      @KingJellyfishII Год назад +3

      This is also pretty much how I solved it

    • @PoProstuLatanie
      @PoProstuLatanie Год назад +1

      I did the same for part 1, for part 2 i serached for stars and looked around them for numbers

    • @MrCumberlander1
      @MrCumberlander1 Год назад +2

      Yeah that's what I ended up doing. Except that instead of looping over chars I just used a find on the line. So I had to do less work manually myself.

  • @jaydeep-p
    @jaydeep-p Год назад +20

    Didnt expect anyone to pronounce chars as "Chairs"

    • @fders938
      @fders938 Год назад +7

      Started off pronouncing it like the "char" in "chart", then midway switched to pronouncing it like "care".

  • @stackercoding2054
    @stackercoding2054 Год назад +1

    My solution was starting by defining a function where you would give it x / y coords where there is a single digit, and it would return the full part number where that coords belongs to, with that function working the rest was pretty straightforward

  • @N5O1
    @N5O1 Год назад +1

    13:06 I think it's because you cant format and write code properly, because you using vim, instead of normal IDE
    Also I don't understand why Vim can't add whitespaces when you go to a new line?

  • @recklessroges
    @recklessroges Год назад +2

    Remember, "Haskell makes you a better programmer" ;-)

  • @xernerac
    @xernerac Год назад +1

    I'm doing aoc in Uiua. I hated every second of this task and gave up on the second star of the day. But I gotta say, looking at you doing it in rust, I'm starting to see why some people love array programming. My solution is a total of 486 characters (including whitespace), and for every component, I can reason its correctness.

  • @DaveAxiom
    @DaveAxiom Год назад +3

    Haskell was put on the wheel! It's a very powerful language and is the most popular of functional programming languages. It has its roots in academia but it's used in the industry often. Its strength is in symbol manipulation making it perfect for this challenge. Benchmarks on Haskell programs have shown it to be very fast too.

    • @eetswalads5528
      @eetswalads5528 6 месяцев назад

      Surprisingly - according to GitHub language usage statistics - Elixir is the most popular functional programming language measured by the number of repositories using it. Just thought it was an interesting fun fact :)

  • @vintagewander
    @vintagewander Год назад +82

    As a rust dev, this season's advent of code really makes me want to just switch to C++ due to the strict nature of Rust trying to prevent you doing bad things with strings, even I know damn well the input strings are just pure ascii chars 😂. Well I can use a library for doing ascii things but currently I don't want that

    • @cysia3683
      @cysia3683 Год назад

      I'm just calling .as_bytes() and work with byte slices lmao

    • @matthewsanetra
      @matthewsanetra Год назад

      Just Vec if you know it's ASCII. It should have string methods implemented for it

    • @ficolas2
      @ficolas2 Год назад +2

      I'm trying out rust for this AoC, and so far, I have only really struggled with strings because of trying to access a hashmap with a String, that had as key type &str.
      Since the strings just have normal characters, I just did .chars(), and accessed them normally.
      Rust so far has been a weird experience, and I kinda like that. My experience with is is, read through like 1/3rd of the rust book, and started the AoC this year

    • @ElZafro_
      @ElZafro_ Год назад

      I'm using C++ and the parsing is just awful. I've tried using views, string_views and even """"modern"""" C++ but i'm missing rust so much on this one

    • @NabekenProG87
      @NabekenProG87 Год назад

      I converted everything to bytes: "".as_bytes().to_vec(); A lot easier to handle

  • @hukasu
    @hukasu Год назад +2

    I did it in Rust, i collected the lines into a list with an "all-dots" line at the beginning and end, walked that list with a window of 3, and zipped the 3 slices from the windows with a window of 7, if the center most char is a symbol, i basically check all possible combinations of chars for numbers, one of the checks being using another window of 3 over window(7) slice
    so in total, i call 'slice::window' 5 times
    my solution only works because the input does not have any symbol at the start or end of lines

  • @largepimping
    @largepimping Год назад +4

    So you kept saying "If Haskell gets on this list, I'm f'd"... but... like... you KNEW this would 100% guarantee they choose Haskell. Right?

  • @bradybrandt8220
    @bradybrandt8220 Год назад +15

    I want to see a challenge completed in assembly.

    • @y4ni608
      @y4ni608 Год назад

      it wouldnt even be hard just annoying af

  • @justgame5508
    @justgame5508 Год назад

    Surprisingly out if all the codes so far (I’ve gone up to 4). This was by far my cleanest and most efficient whilst implementing. Really struggled day 1 part 2 because if the stupid joined numbers. This 1 took me like 30 mins for both part 1 and 2. Walk array recursively find numbers sum

  • @jarvenpaajani8105
    @jarvenpaajani8105 Год назад +1

    Dude, 7 layers of nesting is enough for an elephant to nest into

  • @general_wcj9438
    @general_wcj9438 Год назад +3

    #1 rule of livestreams You never tell chat what you don't want them to do

  • @esveann
    @esveann Год назад

    Cool series! I feel like I hit many similar emotions while solving today's challenge. Especially "I don't like this solution there should be a better way to do this" ... damn I felt that

  • @kenzostaelens1688
    @kenzostaelens1688 Год назад +3

    some guy out there is doing AoC in the game "turing complete", basically assembly but worse

  • @francescotomba1350
    @francescotomba1350 Год назад +5

    These 3 days were "How to make nasty things to parse tutorial"

    • @KingJellyfishII
      @KingJellyfishII Год назад +1

      they were actually quite nice and well-defined compared to a lot of problems I've encountered in real life...

    • @francescotomba1350
      @francescotomba1350 Год назад

      @@KingJellyfishII feel you

  • @mbyx_
    @mbyx_ Год назад +11

    Wrote this day in Rust as well. Surprisingly not painful. It helped that I made the smallest thing a separate function. The very first thing I did was make a function that extracted the part code from a line, from wherever you started on that line if you started on a digit.

    • @rezwhap
      @rezwhap Год назад +3

      This is the way. We must decompose the problem! 🙂

  • @taukaem
    @taukaem Год назад

    Wanted to see how to do it cleverly since I was unhappy with my solution. Accidently you boosted my confidence ;)
    But now I know how to use enumerate(). Thanks for that.

  • @Im_Ninooo
    @Im_Ninooo 4 месяца назад

    9:41 this brings me great anxiety and bad memories. I'm never doing AoC again.

  • @CoolestPossibleName
    @CoolestPossibleName Год назад +5

    Love this series

  • @MrSonny6155
    @MrSonny6155 Год назад

    I don't know why, but I misinterpreted the question as numbers touching parts (other numbers touching symbols) also being parts themselves. My unimplemented solution was gonna be something like:
    1. 2-pass connected components (need to figure out 8-way neighbour helper function for non-dots)
    2. For each blob in raster order, if a symbol exists, sum parseable digits.
    The intended reading is obviously way easier...

  • @Bobbias
    @Bobbias Год назад

    I'm currently working on Day 3 in rust, and I'm happy I decided against the sort of approach you took here. I'm using regexes to locate numbers and symbols, and I'm doing a 2 pass approach:
    Each line has it's own vector of indices adjacent to a symbol on that line.
    Pass 1 locates each symbol and inserts the appropriate indices into the appropriate vectors.
    Pass 2 checks each number on each line, checking whether any of the adjacency indices are within the number's start/end range.
    Currently trying to figure out where my bug is, because I'm convinced I have exactly 1 bug preventing me from getting the right answer currently but code blindness has set in and I'm going mad because I haven't even tracked down which number it fails to count.

  • @VivekYadav-ds8oz
    @VivekYadav-ds8oz Год назад +1

    This is my algorithm for the first half of the problem (also in Rust btw):
    ooooooo
    o69420o
    ooooooo
    All the o's in the above diagram are all the positions you gotta check for a symbol (i.e all its neighbours).
    If you observe, for all the digits you just need to check the cell above and cell below, except for the first and last digit.
    To fix this, just assume the middle line's first 'o' and last 'o' are also digits. Now, for all "digits", you just need to check the cell above and below.
    However, that would mean you would need to check for those two 'o's separately. So, you CAN do that, or you can be lazy like me and instead for each "digit",
    you check for cell above, cell below and yourself for being a symbol. Since digits are guaranteed to not be a symbol, this is just equivalent to checking for the middle 'o's as the check for yourself will always return false for digits. Sure, computation wasted, but effort saved.

  • @nate7803
    @nate7803 Год назад +1

    For part 1, I just looked for a symbol and generated a list of adjacent coordinates and iterated through to see if first they are valid coordinates and if they contain a number. If it is then find left and right of number, convert to int, and replace with periods to avoid duplicates. Part 2 was trivial with that solution. All in it took about 45 minutes. Was very proud compared to day 2. Language Go.

    • @pie6029
      @pie6029 Год назад

      I did the complete opposite thing. For part 1, I looked at the surroundings of each number to figure out if a symbol is nearby. For part 2 I had a Hashmap with the key being the coordinate of the Symbol and the value being the 2 nearby numbers, or 0 if none are there.
      (Rust)

  • @AmeebaBoi
    @AmeebaBoi Год назад +2

    Would love it if you added a timer so we could now more or less how much time it takes you to do these

  • @DMSBrian24
    @DMSBrian24 Год назад +1

    My friend coded a fkin matrix logic based blazingly fast simd solution for this in python+numpy like it's nothing while i struggled with my for loops, kill me

  • @Elesario
    @Elesario Год назад

    Mulling in my head a good way to solve the problem algorithmically. I suspect if you were to redefine the numbers as a set of rectangles (co-ords for top left and bottom right) mapped to their equivalent value, and the symbols also to a set of rectangles that are plus one to each side on the symbol in the centre, and then do a intersection of symbols rectangles to numbers rectangles, then you can sum where you get a hit. I feel like this could be brought down to a few easier to manage passes transforming the data gradually.

  • @drvanon
    @drvanon Год назад

    It's the season, so this guy chose the Christmas tree of death. 7:09

  • @alfaalfa99
    @alfaalfa99 Год назад +1

    "It's gonna work but it's disgusting" - Whenever I get a date now that I'm over 30.

  • @m4rt_
    @m4rt_ Год назад +1

    I ended up rewriting my solution like 3 times. Today was an annoying one, but after 4 hours I got part 1 working.
    Luckily part 2 was relatively easy even though I had to rewrite my entire algorithm to handle it.

  • @yusfcag
    @yusfcag Год назад

    I LOVE THIS SERIEESS

  • @Elesario
    @Elesario Год назад

    Title is the definition of a workman blaming his tools :D

  • @Thwy
    @Thwy Год назад

    Haskell is my favorite language. It's not hard, it's just different.
    Also, parsing input in Haskell is a breeze, you're gonna like it!

  • @calder-ty
    @calder-ty Год назад

    I felt like Day3 was significantly harder than most day 3 questions on AOC

  • @joshuakb2
    @joshuakb2 Год назад

    I solved both parts by building up a list of numbers and a list of symbols, then examining those lists to calculate the answers

  • @d-brox
    @d-brox Год назад

    I also used rust, but I used pest as my parser, since it gives me the spans of the numbers and symbols

  • @J-qak
    @J-qak Год назад

    I also used Rust, also had off by one error, lol. But I kinda like my solution better, I feel like you made it little bit more complex than it needed to be.

  • @reed6514
    @reed6514 Год назад +2

    Please add speedrun timer!

  • @lennartlindell7044
    @lennartlindell7044 Год назад

    You have to add tcl, postscript, perl and forth to that list

  • @xevious4142
    @xevious4142 Год назад

    I kept thinking I was done on this one only to run into another small issue.

  • @SharunKumar
    @SharunKumar 7 месяцев назад

    Oh yeah, I remember running into the same issue. But I think I solved it by adding a column of dots to the right of my inputs 🤣

  • @Bozebo
    @Bozebo Год назад

    Should you not be building these as unit testable modules though and using TDD? ;)

  • @hostgrady
    @hostgrady Год назад

    title: rust betrayed me
    content: off by 1 error

  • @epicboi46
    @epicboi46 Год назад +1

    Next poll should include Fortran 🔥

  • @meetarthur9427
    @meetarthur9427 Год назад

    watching this as much entertaining as hurting at a same time hahahah, I do same way though, all of us I guess

  • @ЯрославСвиридов-в7б

    How you got the first star without handling '/' as a valid character?

  • @dexterbanawon2449
    @dexterbanawon2449 Год назад

    How about dart? Is it included already?

  • @blu12gaming44
    @blu12gaming44 Год назад

    Just watched the first haskell stream on Twitch, that was pure pain.

  • @SpeedingFlare
    @SpeedingFlare Год назад

    I like Rust but I easily create logic bugs because I force idomatic code too hard. When the problem doesn't fit the closest idom, it hurts.

  • @3ckortreat
    @3ckortreat Год назад

    whats your operation system and browser?

  • @karshtharyani4253
    @karshtharyani4253 Год назад

    I did this challenge, and I didn’t store any structures whatsoever and I felt my solution was so naive. But then I had to do part 2 differently. Sounds like if you do part1 the correct way part2 is simple extension, maybe?

  • @binary_gaming113
    @binary_gaming113 Год назад +3

    This problem was not hard, but boy was it annoying to code😢

  • @BlueEagle403
    @BlueEagle403 Год назад

    Not a good year to try advent of code in Rust with Colemak-DH with Miryoku keymap on split keyboard when every single one of these things is new to me. lol. I definitely have an urge to just use python.

  • @Mr-Ibee
    @Mr-Ibee Год назад

    Yeah, I'd initially made that off-by-one error as well.

  • @peperoni_pepino
    @peperoni_pepino Год назад +1

    So, as someone who hasn't used Rust and hasn't used PHP since PHP 5, I have to conclude PHP is currently better than Rust? :-P

  • @dwolrdcojp
    @dwolrdcojp Год назад

    I was able to get the first part fairly quickly but after hours on the second part I stepped away. The code was absolutely disgusting.

  • @Blubb3rbub
    @Blubb3rbub Год назад +6

    Just hoping for Fortran or Forth to come on that list. 🤞

    • @torarinvik4920
      @torarinvik4920 Год назад

      Forth +1, but I wanna see him feel the pain of Haskell first 👹

    • @SVVV97
      @SVVV97 Год назад +1

      Why stop at haskell: ATS! ATS! ;D

  • @johnsonfitzgerald2696
    @johnsonfitzgerald2696 Год назад

    These videos are awesome

  • @NotBlackyy
    @NotBlackyy Год назад

    I messed up both parts at first. I had a pretty nice solution for part 1, but I had to completely rewrite it for part 2. (I also use Rust BTW)

  • @jezura777
    @jezura777 Год назад +4

    First ,your videos are great 👍.

  • @axevanced3233
    @axevanced3233 Год назад +1

    Why he hates Haskell do much? 😂

  • @Tomyb15
    @Tomyb15 Год назад

    Yes! Please now let the wheel fall on Haskell next time!

  • @raylopez99
    @raylopez99 Год назад

    Rust is like a beautiful girl who you fall in love with, she seems to fall in love with you, and it turns out there's a dozen other guys she's in love with.

  • @williampearsall6857
    @williampearsall6857 Год назад

    This makes my solution look clean wtf.

  • @nictheregulardude
    @nictheregulardude Год назад

    first year participating in this challenge do they get harder/more annoying every day? kinda seems that way so far

  • @ssmith5048
    @ssmith5048 Год назад

    Fortran should be an alternate lang -definitely Cobol

  • @PalladinPoker
    @PalladinPoker Год назад +1

    I just wanna see a code challenge done in IBM COBOL.
    Sorry

  • @katzownsu
    @katzownsu Год назад +2

    Rust is still there next to Haskell

  • @btarg1
    @btarg1 Год назад +3

    How do these challenges prevent cheating? Love the videos keep em coming!

    • @nirajandata
      @nirajandata Год назад +31

      these type of challenges are for fun. I don't think people cheat here as they have nothing to gain by cheating

    • @PoProstuLatanie
      @PoProstuLatanie Год назад +4

      Also input for each person is slightly different so if you don't have the code but only somebody else's answer it's not going to work

    • @chri-k
      @chri-k Год назад

      @@Romenamath why does it even tell you if it's higher or lower? That isn't particularly useful for debugging in most cases.
      Is that there literally only to make brute-force easier and thus bait cheaters?

  • @MPelletier
    @MPelletier Год назад

    While not a language per se I want to see SIMD on the wheel.

  • @tommclean9208
    @tommclean9208 Год назад

    my struggle for this problem was trying so subtract a int from a usize, i kept doing usize as isize but didnt seem nice to do

    • @SVVV97
      @SVVV97 Год назад +1

      Why did you have a isize to begin with? I don't quite see where you'd get the signed value from

    • @notkoalified
      @notkoalified Год назад

      @@Romenamath This, or alternatively saturating_sub

  • @ollicron7397
    @ollicron7397 Год назад +2

    This looks like a mess, I dont know maybe it would've been better to look for a solution like trying to work with regex or something related. Think/plan well before writing any code. Theres also special built in functions to parse/trim inputs in Rust you couldve used.

    • @ficolas2
      @ficolas2 Год назад

      The only regex you can use is "\d+" really, you aren't gonna do the locating the symbols with a regex
      Unless you hate yourself

    • @ollicron7397
      @ollicron7397 Год назад

      ​​@@ficolas2 I think you can do something like \d|\* for digits and star as an example but I'm not sure. Still I'd look further into it.

    • @ficolas2
      @ficolas2 Год назад

      @@ollicron7397 but what would you get with that? The problem is that you need to check the Lines at the top and bottom, and diagonally too.

  • @KidB.
    @KidB. Год назад

    We need Rust 2.0 with added features that will make off by one errors harder to make.

  • @lynqsx
    @lynqsx Год назад +1

    I would love to see Lua❤

  • @SupremelyAverage
    @SupremelyAverage Месяц назад

    Life is too short to learn DSA

  • @vidojesevic8014
    @vidojesevic8014 Год назад

    I'm doing same thing, pick random language for day, but my list is smaller than yours. Day 3, javascript 😢, I'm literally 15 times slower than with Lua yesterday

  • @tranquility6358
    @tranquility6358 Год назад

    I'm solving this year's challanges in Go and boy was today difficult. And it's only day 3. 🤣

  • @konstantinsotov6251
    @konstantinsotov6251 Год назад

    Hell yeah, it's Haskell time

  • @chess_ramone
    @chess_ramone 11 месяцев назад

    Can someone confirm pls - was that was 9 levels of indentation?

  • @kahnfatman
    @kahnfatman 8 месяцев назад

    You gotta do VOICEs like Prime

  • @arronshutt
    @arronshutt Год назад

    Forth. That's the language for the wheel. ;)

  • @mskiptr
    @mskiptr 6 месяцев назад

    this one would be so nice to do with Haskell tho

    • @mskiptr
      @mskiptr 6 месяцев назад

      Like first you want a function `detectSymbols : Arr [m, n] Char -> Arr [m, n] Bool`, as well as `dilate : Arr [m, n] Bool -> Arr [m, n] Bool` which smears every True to the 9 positions around it. Then something like `detectPartNumbers : Arr [m, n] Char -> Arr [m, n] Bool -> Arr [m, n] Bool` which marks as True all digits of numbers which overlap with the patches of True in the input. Then you can replace every symbol marked False with whitespace, run `words : String -> List String` on each line and concatenate all results. Then simply parse all the extracted numbers.

  • @Noodle999
    @Noodle999 Год назад

    "Length of the digit" was confusing me... surely that's always 1 😉

  • @marekvrbka
    @marekvrbka Год назад +2

    Writing this in Rust was... fun.

    • @LowLevelTV
      @LowLevelTV  Год назад +9

      no

    • @marekvrbka
      @marekvrbka Год назад +5

      @@LowLevelTV I mean, it made me use a 2d coordinates library (wrapping_coords2d). It also made me realize that a proper coordinate library is missing in Rust, so I guess I will write one to be at peace.

  • @chepossofare
    @chepossofare Год назад

    Tbh i think you pick the wrong structure for this problem, i just made an integer matrix and in half a hour was done :(

  • @torarinvik4920
    @torarinvik4920 Год назад +2

    Haskell!

  • @autumnleaves3012
    @autumnleaves3012 Год назад

    i’m sorry to say but i think your getting haskell 😂 also i made the same mistake when I did it myself lol