Github Copilot MAKES A CLI GAME IN GOLANG FROM SCRATCH?!?!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's left ai yeah this thing's the devil i am  going to use github copilot to write a cli based   game in golang now i do not know how to read a  character from standard in when it comes to golang   i don't really remember the syntax for a struct  and golang i don't really remember any of the   things about go i would have to look up a few  things instead i'm going to let co-pilot write   the whole thing for me and yes i do have to  use vscode okay i don't want to use vscode   okay github copilot's not available for a superior editing  experience but i just have to use vscode okay   i am forced so the reason why i didn't want to do  like a data structure or something is cause you   could just look that up i wanted something that's  a little bit more free form so you can just see   how powerful github copilot actually is to  get started we need the cedar program with   some comments for github's copilot to kind of know where  we're going how about this one create a game   that will pick a number randomly randomly between  1 and 100 and ask the user to guess the number   okay that seems good two users to guess uh to  guess the number whoever let's see how let's see   what they have to say if the user the guest is  number oh no whoever guesses the number guesses   the number closest to the random number wins there  we go okay there we go we've done the whole thing   input comes from the s from the terminal oh  perfect all right oh i like that and output   goes to the terminal all right so let's get  started i think what we need to do is start   with a type of some sort right skype player  struct yup yup yeah all right what else do   we need we probably need a game right to type  uh i'm sorry whoa let co-pilot take the wheel   all right game struck we're gonna have a player  one okay i'll take this we're gonna have a player   too okay i mean i guess random in yeah that sounds  good okay let's do it that seems pretty good right   okay so let's start writing some logic let's  start with create a player all right there   we go create player it's gonna take a name  string equals that all right how about create   game let's see create game all right there we go  interesting create player yup yup yup all right   let's save it get that sweet auto import going  now we've created the player we've created the   game what's the last thing what's the next thing  we need to do ah we need to do something we need   to read from the input uh read input now remember  we've specified it as ooh read input okay okay   i like where this is going var input int okay  printf enter your guess yeah yeah yeah yeah   yeah yeah okay perfect all right so that's pretty  much the entirety of the games like required logic   look at that i didn't write a single line of  code all right so now we're gonna have to do   the hardest part of this we're gonna need to  create the game loop now can copilot do it   here we go create game loop all right function  game loop i like it i like it 4g player one guess   does not equal player let's see okay so it's  actually confused at what game we're playing   we're playing here let's loop a forever all  right uh read a player inputs there we go   let's see check which player is uh guessed closer  to the random number all right so it's a little   confused it wants to see if it's exactly it so  let's help it get a little bit closer let's try   to do this p1 diff equals yeah that looks  pretty good is there is there like a math   dot absolute yeah there is a math.absolute  that one there we go there we go yes that   all right so let's do this again let's do p2 diff there we go all right perfect if p1 diff  is less than p do diff player one wins   else if p1 diff is greater than player two diff  player two wins else it's a tie oh my goodness   that's pretty crazy right now let's see we  should probably do a do you wish to continue   part don't you think check if the player wants  to play again i i didn't even plan this would   you like to play again yes yeah this thing's  the devil what's left ai thanks for playing now ai's will steal your job in the future okay so if you're watching this this should  just blow your mind right this should genuinely   blow your mind now for those  of us who know how to program   this was an incredible experience but we're  not done we still need to write the main   function so to write the main function we just i  i just assume he doesn't go like this funk main   let's see what happens here okay  uh yeah create the game okay oh my goodness okay let's oh oh my goodness all  right so how do i play this thing all right so   let's just run the game see what happens  all right player one guess your number   five player two guess your number five it's a tie   yes 69 420 i am the best no thank you so  much for watching i hope that you liked it   hey leave some comments down below what did you  think about that was that a little terrifying   how quickly i was able to write a program in a  language in which i do not have a huge amount of   proficiency in able to create structs methods  hanging off of structures instantiation game   loops forever loops right like those are a lot  of things i would just simply have to go look up   i wouldn't know they could just do a four with a  squirrely brace i wouldn't know a lot of that but   it just worked if you didn't catch it we actually  did a whole thing live on twitch i'm gonna do a   few more of these on twitch it is pretty fun  to play with unfortunately i have to use vs   code which is just like a death sentence for me  but we'll do it we'll get through it together
Info
Channel: ThePrimeagen
Views: 49,787
Rating: undefined out of 5
Keywords: software, vim, programming, javascript, typescript, software engineering, web developing, web developer, software developer, developer, cpp, programmer humor, humor, reactjs, js, ecmascript, tc39, Netflix, Engineering, Engineer, Interviews, Software Interviews, vimrc, neovim, vim editor, text editor, vscode, vscode vim, vim plugins, autocomplete, vim autocomplete, nodejs, twitch, developer productivity, spacemacs, algorithms, datastructures, Data Structures, python, bash, github, github copilot, copilot, ai, ml
Id: Xw_qbJp52cY
Channel Id: undefined
Length: 6min 10sec (370 seconds)
Published: Fri Aug 20 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.