Have you ever asked the question: hey, howmany programming languages do you know?I used to ask this question a lotbecause I thought that knowing morelanguagesmeant you're a better programmer. Now,think about this.How long does it take to learn a newlanguage? Maybe three months?One month? A week? What about oneday. Seriously. Some programmers can joina new team,learn a new language, and startcontributing code, in justone day. How do they learn so fast? Theycan do this because they're very goodwith a particular toolcalled google. Today we're going to takea look at how to learn new programminglanguages in one day,using google. To set this up, I'm going todo a project I've never done before,using a language I've never used before,and I'm just going to rely on google tofigure things out,and I'll show exactly what I searchedand why. I'm going to build the game2048 using a programming language calledgo.2048 is a game where you slide thesetiles around, and if two tiles have thesame number they combine into a biggertile.And you're trying to get the number 2048.And go is a programming language createdby google in 2007.It's pretty popular for back-endprogramming, but I've personally neverused it before.So I start off with a basic go program,and the first thing I searchis "go arrays" Why do I search this?A programming language can only dosimple things, such as display some text,create a variable, create a function, etcLet's call these"simple language features". What you'resupposed to dois to take a problem, and break it downinto smaller problems,and then keep breaking it down until youcan solve it with simple languagefeatures.Let's take the game 2048. How could webreak this down?Well first we need a way to display thegame, and then we need a way to let theplayer make a move, which in this case issliding up,down, left, or right. And then we need tofigure out how to slide the tiles around,and combine tiles. So we broke it downinto three smaller problems,and I'm going to start with how todisplay the game, because that's theeasiest one to start with.I'm going to save the game in a variable,as a list of numbers,and then I'm going to display it as text.So now you can see that I've broken downthis smaller problem,into just simple language features andthat's what I usegoogle for. Now I know from otherlanguages like Javascript,I can save a list of numbers insomething called an array, and that's whyI search"go arrays" I want to find the go versionof an array.Notice I'm using javascript as areference point. Having a reference pointis really important when you're googling,because you can take a language youalready know,and try to do the same features just ina different language.And this is how programmers can learnnew languages in a day,they already know how to break down aproblem and solve it using simplelanguage features,they just need to google the syntax forthe new language.If you're just starting out you mightnot have a reference point, so start offwith doing a few tutorials, and getfamiliar with your first language.And then use that as a reference pointgoing forward.Alright let's get back into our project,and the first result I get backis from golang.org so this is theofficial website of go.Now when you see a result like this,you're not supposed to understandeverything here, you're just supposed totake the things that look the mostrelevantbased on what you know from otherlanguages. I'm just going to take thisline here,and I'm going to play around with thearray. I'm going to set some values justto get anunderstanding of how it works. And thenext thing I search isgo arrays in arrays. So the game isplayed on a 4x4 grid,and the way to represent this injavascript is to use an arraycontaining four other arrays, each thatrepresentsan individual row. So I'm going to try todo the same thing in go.Generally I read a little bit of theresult to see if it's what I'm lookingfor.This result says "how to define an arrayin go." This is not really what I wantbecause I want to define an arrayinside another array. Arrays in go withan example. This looks like the samething, how to define a simple array.The next result says arrays, slices, andstrings. I don't really understand whatslices mean, so this might not be whatI'm looking for.And the fourth result here saysmulti-dimensional array.So this is exactly what I'm looking for.Now I don't have to understand all ofthis stuff,I'm just looking for a specific line ofcode that seems relevant.So this is the line that seems the mostrelevant, I'm going to copy it into mycode, and then play around with it,and make it fit into what I'm trying todo.So this is what it looks like when Iprint my grid as text,and I actually want it to look somethinglike this, something similar to theactual game board.And I want the zeros to representempty spaces, and if there's a number itrepresents there's a tile there.Just like before, I first break this downinto simple language features,I'm going to loop through the grid. Ifthe number is a 0, I'm going to print anempty space.Otherwise I'm going to print the number.And we'll print some vertical andhorizontal lines in between.Basically I need to google loops, ifstatements,and we already know how to print sometext. It's the same kind of searches thatwe just did,so instead of doing it again I'm justgoing to fast forward through this video,and next we're going to take a look athow to use google to search for errors.Here I get an error that I don't reallyunderstand. It looks like this is a typemismatch,so I'm just looking for something ingoogle that explains to me how typeswork in go.I'm just going to copy this entireerror into google to see if I can getany insight as to what's causing it.This one is talking about a variadicfunction I'm not really sure whatthat means, I'm not sure what thedot dot dot means, so this is probably notwhat I'm looking for.So for this result, there's a lot of newterminology, that I've never seen before.I'm not sure what this code means, orthis code means. I'm not sure what astructis, so this is probably not what i'mlooking for.And the next result also has a lot ofsyntax that I don't understand, so I'mgoing to skip this one as well.So the next result is actually in java,so I'm not making any progress here.I go back into my google search, andI'm going to reword this asgo function type multi-dimensional array.I want to learn how to correctly givethe typein a function for a multi-dimensionalarray, that's what I suspect the error iscoming from.But looking at these results, it doesn'tseem like I'm going to get the answerI'm looking forso I just go back into my code and justmake sure that the types match,and then I'm just going to go with that.I'm going to give up on this search.Maybe at a later date I'll come back toit and learn some more about go.And then all of a sudden, I see thisblack and white percent sign.I'm not really sure what's causing this,I don't have an error messageso I'm just gonna try to describe it asbest that I can in google.The first thing I search is go printpercent and this is not actually a goodsearch, because there's many meanings forprint percent.It might also mean how do you print apercentage sign in go,and that's exactly what the first resultshows us. If you ever run into thissituation, try to makeyour search queries more specific, sothat there's no confusion.So now I'm going to search "go printpercent sign atend of" I'm not really sure what I'msearching here, I just want to emphasizeat end, because I'm seeing a percentagesign at the end so I don't want googleto be confusing it with other meanings.And "at the end of" I'm not really surewhat to describe this as.At the end of the output? At the end ofthe command line?I just leave it as blank to see ifgoogle can autofill it for me.And after making my search more specificI see exactly what I'm looking for.There is a percent sign with an invertedbackground color,and this means that there is no new linecharacter at the end.So all I have to do is just add a newline character at the endand it should go away. Alright, so that'smostly what I wanted to show you aboutusing google,remember it's okay if you don'tunderstand everything in the searchresults,sometimes you do have to reword yoursearches to make them more specific.I hope that makes sense let me know inthe comments how you guys learn newlanguages,and what other tools you guys usebesides google.For the rest of this video I'm justgoing to finish this game, there'sactually not a lot of other googleskillsI can show you. I'm basically just doingthe same kind of searches, which issearching for language features anderrors. And I guess I'll show you how Ibroke down the other parts of this game,to give you more examples of how tobreak problems downinto simple language features.After about 10 minutes this is the codeI made for displaying the game like this.You can see it's a combination of loops,if statements, and displaying text,which is all simple language features.There's three more problems that I didfor this project.The first one is how to create new tileson the board.So after every slide, you can see that anew tile is generated at a random spot.And here's how I broke this problem down.I made a list of all the empty positionsin the grid,I picked a random position from thislist, and then at that position I set itto a two or a four.The second and third steps are simplelanguage features, but the first step canbe broken down even more.We'll create a new array, we'll loopthrough the grid,and if a position is empty, we'll add therow number and column number to our newarray.And now we've broken down all threesteps into simple language features, theonly thing I googled here ishow to add things to an array, and how togeneratea random number. The second of threeproblems I did washow to slide tiles around and combinethem if they were the same number.I had to sit down and think aboutthis for 20 minutes, but basically wejust have to figure out what happensto each row or each column. So let's saythat we're sliding to the left,we'll loop through each row. If there'sone tile,I just need to move it to the left. So Ijust need to change the numbers around.If there's two tiles, if they're the samenumber we'll combine them, and then movethem to the left.Otherwise we just move both of them tothe left. And the logic is pretty similarfor rows with three tiles and four tiles.For this problem, I'm just using loops, ifstatements, and setting values in a grid,which I already learned how to do fromearlier. So I actually didn't have togoogle anything here.And the final problem I did was how tolet the player slide the tiles.I let the user type in some text, this isanother thing you can do in otherlanguages.Then I'll use WASD to represent the fourdirections the user can take.If they entered a "w", I'll slide up. Ifthey enteredan "a", I'll select left, and so on. And I'llput this all in a loop until the game isover.Now these are all simple languagefeatures, and I only had to google"how to wait for command line input ingo"And that's pretty much it for thisproject, I know there's features that aremissing, such as how to check if the useris blocked,or how to check if the game is over, butthis is the core functionality of thegame.It took me two and a half hours, which isnot bad considering I'm using a newprogramming language,and just relying on google. Thank you forwatching, my name is Simon fromsupersimple.devI want to make a tech career possiblefor anyone. If you have any questions orcomments, pleaseleave them down below. As always you cancontact me atsupersimple.dev/feedback I'll see youin the next one.