Advent of Code 2021 πŸŽ„ Day 5 πŸŽ„ Golang TDD

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
i think that is better i think i reset my computer and things are working now should be able to hear me there's a little hiccup before welcome welcome to day five um let's get cracking this advent of code day five all right we're still in our submarine nitro thermal fence on the ocean floor avoid them forming lines that's a relatively simple input it'll be easy enough to parse and i think we should start um feeding in the data now so before we've been just basically scanning the data file and just pulling it in lines of strings i'm wondering if we should start doing a little more of that manipulation on the front end there so for example on this one doing like one replace action with you know space aerospace and turning it into a comma and then using the comma to split split into an array right so we have the just the four numbers and then even um changing those numbers into integers right we know we are going to have to do it anyways well probably in some cases we don't right but in this case it looks like we will right so they form lines here's the coordinates um x1 y1 to x2 y2 coordinates so 1 1 to 1 3 covers points 1 1 1 2 1 3. okay uh only consider horizontal and vertical lines well that is sort of uh telling us what it seems like the second part is going to be right so potentially we only have to deal with you know a portion i mean certainly we'll only have to deal with a portion of these so like we'd ignore this ignore this do that because four and four this okay yeah and that's what we can do we can say are these two equal or are these two equal because that would be the criteria for knowing that they're either horizontal or vertical right all right so um we'll make a function to test for that um it looks like what they have here is kind of an array with okay so they intersect gotcha so it starts at zero and that would be easy enough right you do your operation you make two different kinds of loops right um either sort of a group over the low row or the root loop over the column depending on if it's horizontal or vertical and just increment up to one they have dots here to make it easy to see but potentially mine would be zero um number of points where at least two lines overlap so anything greater than one is that what they're saying okay that seems easy enough um [Music] let's let's get started let's go ahead and use um for again as our base all right so let's first start with our inputs our test input glad to be done with those two part problems [Music] and our parcel input how many did we end up having here those bingo cards 100 um okay so we should see 500 so that's not so many um anyways in thinking about this there's two ways maybe that we could do this right we could have something like a array like they have here um where we you know every time we get a number we grab that array and change you know the xy index indexes based on their um based on their instructions um the reason why let me open this again the reason why i am resisting that is because it's looking like it's gonna be like a thousand by a thousand array right so that itself is like a million different points and i don't i mean i'm sure that's not a problem that's not that big i suppose especially if you're like not going to be remaking a new one every time you're just going to be pointing to the same one right so um alternatively what we could do is make a map right and the map keys contain something like this right and we increment that right so we only cover the you know so in this case instead of having 100 data points right in this array we have however many this is right like 15 20. um that could potentially be faster but also that could be like way worse because now instead of having you know a million just digits right that are you know probably no greater than three or four so probably like a single digit right we have a map that has a million keys right that are you know what would be like three comma three so like seven characters in length and that's probably not great um let's do the simple thing and go with this go with this map um yeah okay so let's look at our okay we don't need a bingo card anymore we need an error check we'll probably need a make int we're going to mess with this load input quite a bit we're going to do something like this right but i'm going to make it fresh bingo cards don't make all the cards i'm still happy about yesterday we took sort of the long way about it but at the end of the day the second part was super easy all right let's go look at the tests um make and we'll need make array we won't need that and we'll just get rid of all this okay all right so making we like to keep that that's one of our very common um things that we got here um for this one i think what i want to do is um a list of a list of ins and i'm going to try to use my newfound vs code boo to make this happen right so what did i do control shift down okay so i'm gonna need curly bracket there we go that's easy all right getting better at this all right so let's find a way to uh do this um go test so there's going to be a number of other things that i'm going to want to do in here right [Music] i'm going to want to i'm going to want to make that slice right um take this off i should get used to it um all right um and so let's think uh search equal what we would want would be make that a little easier to look at um zero nine five nine and make slice and then we'll pass the quote okay so let's go ahead and test that and we're going to want to make slice i don't want that are we hold on this is still going to be a string all right um is it not saving all right so make slice i mean we could combine those two and maybe it would be a good idea um but we do know that we're going to be passing in a um string just a regular string because we'll do this line by line um we will return list of strings all right um okay um all right so let's see um so the first so we're passing in that so we're passing in that full string the first thing we're going to want to do is string equals strings replace and so what we want to do is first replace from string [Music] this space arrow space guy here and we want to replace that with a comma okay so that's the first step so we're just going to make this the commas as far as i can tell hold on let's look yeah i mean they all going the same direction right so just a little bit of um initial parsing right there and then we're going to um return strings split str on the separator comma right um right what is it like this not enough arguments oh because we have to say how many of them to do um we want to do it i think it's minus one if you want to do it for all of them right we just do it for one of them right uh i don't need this do i we can just pop this whole thing in a one-liner let's uh let's try it go test our test passes um we're able to do this with those now the question is do we want to yeah we're gonna we're gonna separate them out right um so let's make another test for it'll be pretty similar um make imp slice and what we will pass in is that string and what we will want to return is basically the same thing right with an inch and all those just numbers all right so [Music] we making slice all right so we're going to pass in a string and we're going to get out the ends all right so let's copy this and slice and what we're going to be passing in is i'm still gonna call it string um even though it's let's just start typing all right so um [Music] you know we do need to make a all right so for don't care about index number in range string um and we're going to then slice the pen in slice to make int number you should put this above here so we kind of use it first it's it's a requirement right for the other one that's just how i like to do it you know some people do it alphabetically i sort of build it out as as i need it right um okay so let's test that it passes okay so now we are able to actually do this obviously it's going to fail we haven't really okay so here we go um block scanner texts so this is making the block which should be a string right and now we need to manipulate those strings right um so we're gonna say block equals um so we need to make the slice of it first oh okay so i need to make a new thing um okay so we're gonna make an in slice here and we're gonna we're gonna get there eventually right so currently it is a list of strings right then we want to turn it into make and slice okay so now it should be at slice events okay and we want to change that to input however this should be um our input is going to be a list of a list events right right because just it's going to be those nested nested lists all right so let's look at main right all right so let's test it now this is our part problem right here okay um what do we got here oh okay passes all right so we're now able to get just those numbers out of our initial um reading the file okay now there's another thing that i'm going to do that because i'm going to be like making different sizes of um different sizes of uh arrays for these two is i'm going to test making one um so this is like for our testing we're going to make a 10 by 10 array and what we want let's um we're going to pull this out somewhat 10 by 10 um and we're going to all right so how many of these we need we need um uh five six seven eight nine ten and 2 3 4 5 6 7 8 9 10. and uh we're not gonna have any argument into that um so what i'm going to do is i'm going to make a 10 array i'm going to have two functions and make a 10 array and make a 100 array right and they're going to be equal right but um in the testing case i'll like use the make 10 array as like an input in some of my stuff um but in main.go i'll have some sort of sort of ray it'll be like you know currently you know make 10 right but it'll be it turned into a mate country array so let's um go ahead and test that we don't have a make 10 array this is going to be after we load our input so we'll put it down here and it doesn't get any uh thing passed in but we do return maybe this is something that i should not care about it's a sperm here why oh okay so test it what's this template test what's that even mean oh oh you know what that's why oh that's why i've been having some weird oh okay good let's fix that i should go back and change all those now um all right what was my my problem was um i'm not using this so i'm going to comment it out i'm actually going to make it 100. that's what i'll end up having all right so or is it a thousand isn't it it's a thousand all right that would have tricked me later wouldn't it wasn't mad about this ray declared but not used all right so this is still test okay still tests i don't know why it's asking about anything here maybe it's talking about this okay well anyways all right so um right so [Music] what do we got now we've got our array we've got all of our instructions now it's time to start going through them now the way i see it as we go through these instructions we're going to have to do a couple things and make some comments for what those are we're going to have to [Music] figure out if it's um is it uh horizontal is it vertical that's all that we need right now right um and the nice thing is that after um after okay so we're going to look at the instructions for example 0 nine five nine right and we're gonna see that these are common but the same which means it's horizontal horizontal what did that mean yeah horizontal um those are these guys right here um is that right yeah zero right here index zero index nine to index five index nine right so we're doing a sort of column in the first spot and a row this nine right okay so that's going to be something we might get twists around the axle for right and what we're going to want to do is let the dog out of this room poppy you want to play with marsh all right all right i'm back so um um so is it horizontal is it vertical we'll figure out logic for that and um you know like do horizontal right change those indexes and um do vertical and what's nice about this way of doing it is that um what we can do is you know rule those out for the next part which i feel like undoubtedly will be you know do all the other instructions that we're having you skip over like that seems like a great so all i would have to do is now that i know that it's not horizontal or vertical figure out whether it's you know diagonal this way or diagonal this way right and then put a test in and do the stuff and use the same logic the whole way right so um so that's what i'm gonna do that's what i'm gonna do i can even pass the results from part one into part two right so and not even have to you know think about the rest of the instructions or just doing both the same time return one result yeah whatever think about that later all right so is it horizontal so let's make a test for that um test is or is okay so that we want this to return sort of a true false um true false uh and what we're going to be passing in is is that like that list of numbers right um and so we know that um 0 9 5 is going to be horizontal so that's true so we know that let's grab this one 8 0 0 8 is diagonal right so that should be false um two [Music] getting them from over here two two two one should be false i'm gonna add some comments here right so um which way is this diagonal so we'll start at index eight zero and go to zero eight is that right so this would be diagonal that way right this is vertical all right now let's find um another we'll just switch these around um zero zero two five five right is diagonal in that direction all right so that should also be false all right so let's go ahead and test that obviously it's going to fail let's make our code for it um and we're going to be passing in the coordinates which are um mint and we're going to return um and i think this is easy enough as we turn um chords one equals chords three right let's test it passes all right so what we're checking is that these two numbers are equal right okay so now let's we can use the same set for [Music] is vertical basically right ready um what do we got here vertical is true we know that it's gonna let's um let's just make it and for this one we're going to be doing zero and two right okay um passes okay so now that we can check to see if they are [Music] um true right so the trick the trick here right is to know how to loop through our array right so what we need to do is let's make test right and we're going to say our um array equals we make this array make 10 array right because we need an array to do the operation on and we want the results to equal all right so which were or say we should call it flip um mark mark horizontal um all right so this is our horizontal one we're gonna get results and what do we want um [Music] you basically want uh zero one two three four five to become one right that's what we want our results to be oh we need to pass in two things right we need to pass in the instructions and we want to pass in can i just pass in the we're just going to pass in the pointer to the array because we want it to be the same array right um and then we want it to look like that all right so let's test it undefined mark horizontal let's make it um you know let's actually put it here right um horizontal and we're going to get coordinates which are [Music] that and um array which is oh it's going to be hard to test because of this i mean i could make a custom type i guess well let's see maybe and maybe we just test it this way right um let's see if this works see if i'm doing my pointing pointing right all right so there's a horizontal one um [Music] so what we need to do is a for loop um for i equals and what is going to change right it's going to be the so here is the thing there's no telling us see how this has zero to nine and nine to zero right we don't know what order these are in right so let's start equals i'm going to just declare a variable um [Music] there it is our start and i think why is it mad about this what's with all this array declared but not used nonsense being kind of annoyed with that is it this one where is this 66.2 i feel like i've never seen whatever keep on onward um start and can i do that maybe multiples our apc string yeah okay start indent okay i think that those are done okay so we need to do some logic to set them right um just an if if chords um so which one do we care about we care about uh the first one and the third one so if chords zero is less than and we know that they what if they're the same we'll just do less than or equal to just to do it all because if it's just going to be one loop then it doesn't matter what order they're in um and we're gonna have to do an else for the is horizontal or is vertical right because if we don't do an else if then it'll hit on both of them right so let's remember to do that because things can be both horizontal and vertical if it's just one like i feel like there actually is one here maybe not um all right i see they just overlap a little bit there okay so if it's less than or equal to chords three what's happening here i don't care don't worry about it okay so if that is equal to then start equals chord zero and equals chords three wait yes um else equals all right so now we've set the start and end right now we are going to go over start um these are indexes right and we want to do it so um i will we'll figure this out right less than or equal to end because we're inclusive of that right i plus plus right um okay so i um array so this array right at this is horizontal right so [Music] at chords i equals all right just like plus equals can i do that oh chords two right because they should be the same and then i'll return the array after all that what is this array declared but not used what array this array oh i need to return it um can i do that see this is where i get super confused i know that's not right but what did i return all right um let's learn something um so let's because we want to just use the memory address right um i think you know let's let's not confuse ourselves what is this but start end array declared but not used what if i named a tay it still says array right so that makes me think it's coming from somewhere else where is it one the test function make array don't use that i do use that you use it use it return it all right i commented it out all right i might just have to deal with the fact that it it's just gonna do that forever all right it's two oh it's because i set it to two okay let's get out of this all right so i'm doing it wrong doing it wrong i did zero one two three four five am i passing in here passing in zero to five okay so zero one two oh because it should be two here let's test it again still doesn't pass but it should do a better job actual um that's my problem pass okay so now we're able to mark the horizontal things the way that we're expecting to all right now let's make another test to do the burke ones vertical and what's the one that we had that was vertical two two two two two one and and that should start zero one two two two that's that's this one right here right we've got a one here and a one here all right let's test it it's actually i mean it should be similar right so let's with the exception of like the indexes so let's um right so instead of this it's going to be coordinates one hold on um control one and three right so those are the ones we're looking for and that'll satisfy start and end and here we're gonna say we're gonna flip these right i and chords zero let's try it passes all right all right um right so i think that that's all we need to do we just need to iterate through and assess these and see what we got all right so let's go ahead and make our let's also okay i want to test another one um result one one no we're gonna do it up here because we're testing horizontal first right so result one result one all right um right now let's just uh let's make it array one and see if all right so it it didn't um yeah so it didn't actually change those arrays okay so we're also able to do just single spots all right so i think it's time for our test like our our whole whole little guy so let's um so we don't need any of these right um we do need to load our data though don't we load input okay so we're going to do that and what do we want our result to be five comma here why is it mad oh because it's not yet hold on i have to do one quick thing all right so we need to actually change this right so that it will um allow us to pass in those the data as well as the array which is currently 10 by 10 inch we're gonna have to change that when it comes time to um actually go right so [Music] we need to do what do we need to do so we need to go through and change the um for don't care about the index the line in range data so we're going to range through the data um if is horizontal line then we will array equals mark horizontal line array yes elsa is vertical mark vertical line in the array okay so that should go through change everything right now we're going to go so um for row in array let's range column in row if column is greater than 1 then we need a counter uh overlap and then we're going to return overlap let's try it oh what do we got what do we got what do we got not enough arguments to call part one data in in array 10 and then oh that's down here i'm just going to comment this out then all of it passes all right so i think we're able to do it now we're going to have to what do we got here data array we need to make this make 10 array live and then we need to make these i need to do it with a lot of stuff all right i think i think we got it i don't know how long it's gonna take let's see go that takes a while one second let's see what it is though i feel good about it i said that i don't feel good about it but we did it one gold star hey my friends lots of people here all of a sudden welcome um yeah i'm doing advent of code it's fun it's fun today's day was it today day five um i looked at it last night when it first uh came live but only thought about it now we're ready for the old switcheroo yeah diagonal right that's what we expected um so let's actually bring these back down so that we can test oops um yeah you can always uh you can always send me more people that always makes me happy i'm not used to having people watch so i'm also not used to uh talking to people in chat so i apologize if it takes me a while to get to you um all right so i'm going to comment all these out again and we're going to go back and you know we're just going to do the same thing where we made the test for vertical and made a test for horizontal right so [Music] at least we know that the remaining ones are going to be [Music] diagonal so really all we need to do is uh test yeah i'm wondering why anybody used floating point numbers too everything's uh everything's ins um so let's see now that people are actually watching it seems like so much more pressure all right so um [Music] what do we need we can just assume that they're horizontal the question is do we need to um no i don't think so i think all we need to do is find out like which one's smaller and larger and then iterate the one up and iterate the other one down at each step um i mean this is always going to be the harder part have you guys seen um the uh link for people who uh let me see if i can find it hopefully this doesn't open in my main screen hopefully it opens at all there it is not my main screen good um you gotta find the link there's um there's a somebody made a graph um of the speed at which the top 100 people completed um like parts one and two of each day and obviously none of us mere mortals will ever um you know get there right but it does show sort of the complexity of each day right and if you even mouse over it shows you the the crazy fools who do it at midnight right so you could see that like day one and two were relatively easy um day three part one was pretty easy and then like part two got much harder right yesterday hardest you know and so it has all the years i was doing um sort of in preparation for this year uh 2015 and got like wrecked by day seven i i had a really hard time doing it and then obviously this one this is the first year in day one nobody even like knew about it right yet so um it took throughout the day for people to even learn so that's why that one's so big real cool real cool data but yeah it'll be interesting to see throughout the day as or throughout the month as things get harder sort of where they where they land it does make you feel better when you don't complete it in a little bit of time just that even the crazy people took 10 minutes to do it sit an hour and a half um all right so where were we thinking about thinking about how we're going to test because i'm trying to test test everything before i do it which makes it easy because i haven't ever gotten one wrong once i've submitted an answer right so um so let's so let's assume that if they don't let's look at what we got here right so is horizontal is vertical right um let's assume that if we're past this point then it just is vertical i've got a small child here that continues making me food thank you gotta eat gotta eat um yeah so let's see here so we're going to assume we're just going to assume that they're horizontal and vertical and we're going to have to think about the logic of um i don't think it matters like the order that it is if it's going to be a diagonal anyways does it well one moment i think maybe i have convinced her to stay in the other room for a little while longer okay that's one reason why it takes me a long time to do this the other time is writing all these tests um but that's what i'm trying to get better at the testing part and go go i learned go like a month ago or so so trying to get better um all right so we're going to assume that all right so let's just mark test we call this diagonal oops should have and we're going to want to um do both of those diagonal ones so we'll just do some easy ones right starting from zero 0 0 to i don't know 2 2 and we want result one result one all right so we want zero one two and we're gonna need to have another result two and let's go with shoot shouldn't have done that um what's another good diagonal oh we'll just do that when they got there one one three three no i already did that nine seven seven nine and that should give me what is that nine verse nine seven seven nine zero one two three four six so nine would be here you know i'm not gonna lie i'm bad at like coordinates um let's just let's just figure out what this would be so that would be um zero three two three zero all right correct me if i'm wrong save all right let's go ahead and test them oops fail obviously now let's make a method for that and just like the other ones we're going to pass in coordinates which is oops and [Music] the array which in this case is 10 by 10 because we're still testing um all right so now we need to have some logics to say so we know that none of them are equal right um [Music] because if they were equal they would have been horizontal or vertical so now what we're going to do is test whether um because either one's going to be increasing uh are what are these cases um [Music] oh jesus this is why it takes people a long time for the second one um [Music] we'll get to that we'll get to the rest um but the let's see if you know we're just going to try it right because if um so this is checking the first two if this is less than that so what are my options let's see what my options are if [Music] um ones oh my god this kind of math just really messes with my head i need like a piece of paper or like i can't see my piece of paper oh my goodness my daughter brought me all this toy food best face all right so paper let me think about it so if the i mean there's only two diagonal options right so that means if the one is going down oh but they can be reversed right they can be reversed so let's that's why that's why i'm getting confused okay so if we started on like the small end right and worked our way to the big end then it would you know we could only assess you know if one's going up and if position zeros going uh from position zero to position two is going down then we would know the shape of it versus if it was going up but the problem is is that they can be in either order right so i think what we might need to do is um set like at least coordinate you know these two in order from smallest to largest right let's see [Music] so if zero is greater than two then i'm going to rearrange them um oh yeah that's what i'm going gonna do i don't even care um let's see int and i'm gonna populate it with chords two chords three towards zero ah chords one right so what i'm doing is in the event that something like this happens i'm going to switch those two numbers around right so it's going to be 7 nine to nine seven so that i can just sort of always know how my numbers are iterating right if this first number is always going down right now i only have two options right let me make a comment um so one one so this first case one one two one three would stay the same but this one would become seven nine two nine seven and you know let's even call this three was it going up i'm changing it all right this is becoming increasingly hard the um [Music] okay so we switch those around and now we're just going to iterate through it we're just going to we're just going to go through it if so we know that those are decreasing and then we're going to say if um now we're gonna check the second spot right if chords one is less than chords three then we're going to have the loop where let's see let me minimize this so that i can look at what i built for the other guys so we're going to do our loop here um or [Music] i equals we're going to do it yeah i equals chords would that be zero uh to i is less than or equal to while i is less than or equal to words two i'm just gonna let myself get wrecked if need be um we're going to set just a j value to equal chords one okay um just because i and j is easy enough way to iterate oh i need to i plus this okay so we're going to do this change with i and j i think plus plus and then we're gonna do a j plus plus and then we'll return right um and then we need to do the opposite right um this might be let me just do an else i think all right let's give it a try what's result too oh i forgot to zero zero three three okay well that would be two two all right okay so it is not happy what did which one 1 52. so it didn't like 152 but the first one was fine okay so the first one was fine um it was able to do the regular diagonal but it wasn't able to do the other diagonal um what did it actually give me let me pull this up a little bigger then let me make it a little smaller to see if i can turn it into something that looks there we go ah okay ah okay whatever we're not gonna be able to do it so let's see it gave me uh i wanted it to do diagonal what it did was oh all right what it did was it gave me sort of this direction that's not what it was supposed to give me is it um i am puzzled because part of me thinks that i did it right um but i'm just putting these in wrong zero three two three no i'm i'm i put it in right all right so let's make this pass um so this is saying if one the first one is bigger than the second one right um do we need to switch these around no we're still doing the same thing this is the j we're just starting at three and getting bigger or should be starting at three and getting smaller no so we're going through the rows what we want to do is yeah we want to start at the bigger one which is one and get smaller that's what we want now let's test it no it didn't work let's see um it's still oh that's we we did pass it this time um i just did it wrong um what i did wrong was on my test is saying that i started at three but i actually started at two here didn't i zero one two um so this should say two now when we test it it passes okay now we can do diagonals uh let's go ahead and do the integration testing here for part two i think that's all we gotta do um right input array is it mad about array oh because i haven't said it yet uh and what do we want um total of 12 points so 12 points save that let's go back over here undo um actually i don't need to uncomment out these do i i just need to oh i need to actually put this crap in there um [Music] let's just copy it all even though that sort of goes against my you know we're just gonna like run both of these twice i could just have it run the first one i suppose right so um so here we are doing no i copied the wrong thing i want part one okay so let's see uh else if it's vertical else we know that it is um uh diagonal so we're just going to add in array equals mark diagonal with the line and um the array and then we're going to [Music] do the same thing right right go test passes excellent you guys ready for part two in real time all we have to do is i'm going to change all of these i guess i could do them where do they start there's so many all right too i think that's all i need to okay now let's run it now this is going to take some time you know i'll just not run part one how's that sound go run main [Music] it should take about the same time right i mean i guess it's doing a lot more operations all right so no this is the first time this is the first time i've submitted an answer that hasn't been right what what did i do wrong let's think let's think bring these back to our tens so that we can go test again it passed but why did it pass why did it pass why did it pass you guys um there must be something that i'm not thinking about let's um let's do more of these let's do the ones that we got to switch around um we can use that same oops we can use that same thing but let's say two two zero [Music] zero [Music] and see if this successfully okay so that's able to switch around same thing for this to zero zero two what did i do there all right what am i not doing these right like is my um my diagonals not good let's find out which one starts at zero zero or has a zero zero in it well maybe none of them have a zero zero so the first one was this so if part two has this it's gotta have a zero zero in it where's one there's another oh there there's zero zero zero eight um [Music] or zero zero to eighty indeed go that way huh i feel like this should work is my logic not i think i wonder if my logic is not good so if it's horizontal which would allow it to be because i think in in my in my horizontal is horizontal logic here i have than being equal right no so i have an else if i feel like hold on we having a different actual question with two or larger i mean that's what i have greater than two um is that it greater than or equal to hold on a second i got a phone call i gotta take all right i don't know i don't know where this is going wrong um [Music] i'm not used to things passing on my tests and then failing failing in my no no what we're gonna do we're gonna copy all of this and re-paste it um oops what what have i done wrong looping through them normally anybody watching knows what i did wrong i would accept so we're gonna go through each line it's either going to be horizontal which it can be both horizontal and vertical if it's just a dot right but because i have the else statement that'll be covered in the horizontal so dots and horizontal are covered verticals are covered we know those are good our marked diagonals should be working right i mean it's working for all these it's 12 and that accounts for things with like threes and what not this should be fine this should be fine i'm gonna oh i didn't want to do that whatever am i going to be so silly that i just run it again without changing it let's um did i still call that part one call it part two oh my goodness did i just run part one again oh no i did run part two all right well let's well i got the same number thank you for watching me struggle through this riding the struggle bus right now currently i have tests that pass for my um for my test data set um but do not pass for do not pass for the actual data i'm going to reread this to make sure i'm going to type it in again but like manually maybe it says it's too low so that means that we're not counting enough right um there should be more with the vertical lines i mean what does that mean why didn't i mean these are like the test cases right where it's the different kinds of diagonal lines now clearly on the tests have lines going in the different diagonals why isn't it picking them up let's change these to one get rid of this and our tests again it passes jesus this kind of stuff is so frustrating when you don't even know you don't even know what you could possibly be messing up anymore we know from part one yes yes i do it's right here apricot 4. um i'm making my 10 by 10 array i'm loading my input here and getting 12. out i mean it's probably like i wonder if i added like it did like 1990 8 1 or added one to this if it would work it's always enough by one i mean it is embarrassing that it takes three seconds to do this this is really not optimized but i'm gonna get the answer first i don't think so either um i'm just trying to think of what else i can test for honestly right if if i'm doing these unless i'm doing them backwards am i doing these backwards no like zero zero eight eight you know is this line right here right it's not yeah no i'm i'm doing them in the right angles man this is very troublesome columns and rows what do you mean by that i swapped columns and rows my my tests here shouldn't return the proper result right and i'm i'm doing it with both of these right i i'm you know doing it regardless of what order [Music] these uh they're presented in right because i know that you know that they can you know put them backward or forward the order the order doesn't matter of them right or with them i know that it should be just my horizon i mean my horizontal and vertical seems fine i assume that there's some overlap on the edges right three two two one so i'm swiping around swapping them around so that the first index is always smaller than the second so that i could like iterate that i plus plus right and then this one i figure out whether this second value here right is smaller or larger and if the first one's smaller then as i go down the columns down the rows i go up right plus plus with j starting at coordinate one if it's bigger then i start up here and i subtract go down that way with the minus minus so i feel like this works why doesn't it work is there like is there something else that i'm not thinking about some sort of i can't do nothing else after that can i because for i right i'm always see i i would i would expect that to apricot for i really really would but the reason why i am struggling to believe it right is that when i have these tests and i'm passing in like these coordinates i'm getting out result one here which is what they should be right okay the test case so do you want me to do like uh let me copy let's make a result three the problem is i'm bad at math right and that doesn't okay i will listen to you one two seven eight okay and what should that look like so starting at index one okay so we're starting with zero one two so that would be one right there and then zero one two three four five six seven [Music] zero one two three four five six seven eight right so this is what it should look like apricot for my savior oh man all right you know the reason i used uh symmetrical was because i'm it's because i'm bad at math um and i have a hard time uh like making sense of this stuff so all right so in this case right here let me i'm gonna maximize this and i'm gonna split this over so that i can look at what i actually want oh i didn't save this i didn't do anything meaningful okay so um so let's loop through what am i doing the first thing i'm doing is swapping around nope not doing a swap here because zero is less than seven okay so if one all right so i'm here on this else and i'm going to start well what did i make it look like um beautiful okay oh yeah that's not right oh no that is right it's just the line over there so expected that i am one two yeah i'm off by one here is where i am it's just none of my diagonals must have so nothing on the first and second line here however i have something on the second line at position here so my i is off by one why would my eye be off by one i'm starting it at this position right wait did i type that wrong oh okay so i need to do ji is that what i need to do i think that's what i need to do is that what i need to do no that's not what i need what i don't think i did that right no i didn't think it's still i but why is i off um starts at coordinate zero oh no it's because j's off but j is a coordinate one okay so j should be two zero one two so what i'm actually getting is i'm going to put a star x what i'm actually getting is no um this um so why am i second line three four five why why would i get that nothing about what i'm doing is telling it to start at anything that starts with the three like there's not even a three zero one two oh because it's starting at two one all right so i do need to swap these and now what do we got so i treat my arrays is that right you're right um the thing the thing that the thing that is left to right oh this stuff is really hard on my brain i need to like get a pen and paper out or some nonsense um oh there did it down all right hold on honey one sec all right let's go ahead and now that we're passing passing this again okay we're gonna go ahead and test it please stop making noise just like all right that is larger let's give it a shot there it is apricot you have you have saved the day and helped me not be so bad thank you all right that's it for me today um thank you all for joining thank you all for rating me um i've you know i'm i'm new to this whole twitch thing right so uh i don't know how to raid somebody else do i just look for [Music] let me see add rate a channel let's see if i can figure that out i need to find a channel to raid yeah but how do i how do i find a do i just like find another stream that's streaming advent of code let me see um i spelled it right past videos live there we go i found one let me see i think right by the way everybody there we go i'll be able to do this they got two people now um so if uh [Music] you guys enjoyed this usually i um do these during lunch my lunch break or in the morning because i started getting self-conscious of my personal leader boards um but thank you for joining um i post them to youtube afterwards um if you want to rewatch all right take care everybody thanks for watching thanks for helping take care oh did that not work crap see i told you i was doing this here we go um no i did that i uh i clicked a little oh yeah i clicked a little corner corner x because it was taking so long i didn't know there was a countdown sorry all right there we go did that work you
Info
Channel: misterjacko
Views: 27
Rating: undefined out of 5
Keywords: AdventOfCode, Golang, LearningInPublic, Programming, TDD, twitch
Id: 8DnpjH8Qk6U
Channel Id: undefined
Length: 145min 40sec (8740 seconds)
Published: Sun Dec 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.