Up and Running with Git Transcripts
Chapter: Teamwork: Branches
Lecture: Creating a Rock-Paper-Scissors app

Login or purchase this course to watch this video and the rest of the course contents.
0:00 It's time to write some code and explore this idea of branching the first scenario that
0:05 we're going to explore. Is this going back in time to fix a bug report
0:09 Remember this applies to software that you ship.
0:12 This applies to especially packages or like a desktop application or anything like that.
0:18 Web apps not so much because usually you just fix it and push that out.
0:23 You don't go back and have a historical version again unless you deliver the web app
0:27 to someone else for them to host.
0:30 So what we're going to do in this section is we're going to create a new
0:33 repository. We already have funny web,
0:35 we'll have sketchy rock paper scissors.
0:42 That's what we're gonna have for our next one.
0:44 And this would just be an A RPS app.
0:47 Super simple. Again I'm gonna make it private for now.
0:50 And all this code is going to go into the course repository but not as a
0:55 separate repository. Who knows. Maybe I'll make them public again.
0:59 Go ahead now to read me going through this once more.
1:02 Just so you kind of get the chance to say all right,
1:04 I see how we're creating this repo and everything.
1:07 We want to set this up for not icon.
1:09 What python. And it doesn't really need a license unless we were to make it
1:14 public. But what the heck MIT
1:16 People can rock paper scissor all they want.
1:19 So let's go and create that.
1:21 Now. We want to check it out and I'll just put it over here next
1:24 to this other one. Say a new clone from url copy the url up
1:30 here. The destination path is going to be/desktop and we can give it
1:38 a shorter name of flow. And we could just call it rps even though the
1:41 name on the server is sketchy rock paper scissors just so you can show just so
1:46 you can see that that the names are super long or don't make sense of the
1:50 directory name. We can change that and there we have it on the desktop.
1:55 Cool. Let's open this up in finder.
1:58 Now this project won't have any external dependencies so I'll probably just skip creating a virtual
2:04 environment for this one. We'll see.
2:06 But let's open this up in PyCharm.
2:09 Drop it here, Python 3.9 is not the latest but it will be fine
2:13 So let's go over here and we'll make a python file just called game.
2:18 Now, instead of you watching me type out rock paper scissors,
2:23 I have some code that I got from.
2:25 Another one of our courses here.
2:34 Now instead of you watching me type out rock paper scissors,
2:37 I got some code from one of my other courses.
2:40 The beginner's course, beginning python course where it implements rock paper scissors in a somewhat
2:47 nontrivial way. So a little bit of an extensible way.
2:51 So here we have our roles which is very cool.
2:55 We've got a little part where it'll print out what it is.
2:59 We don't really need to say what addition is.
3:01 Let's say version instead. Let's get rid of this line.
3:05 I want to say version 1.0 This is our initial release of this app.
3:10 And these rules up here say if I'm a rock,
3:12 the rock is defeated by scissors or defeats the scissors and is defeated by paper papers
3:17 defeats the rock but is defeated by scissors and so on.
3:22 So the details of this are not super important basically it's it's pretty simple but let's
3:26 go ahead and run it just to have fun.
3:30 So let's go over here. What are we gonna roll?
3:31 Let's roll rock. Alright well computer played rock.
3:36 So we're tied. If they played rock maybe they're going to play it again.
3:39 So we should play paper. Oh they played scissors.
3:42 They cut us up on that one.
3:44 Not so good. I think you play three rounds.
3:46 Let's just play a few more and see what happens.
3:52 There we go. Best of three.
3:54 We only got two with our straight down the middle.
3:56 Rock. Play at the end there.
3:58 And computer mix it up in 1 3 of the rounds.
4:01 Okay so this is going to be our version one of our game.
4:07 We're ready to check this in.
4:08 Right? So make sure everything is saved.
4:11 Now we could just commit this in PyCharm but let's go ahead and just mix
4:14 it up and I'll come over to source tree and we'll commit it here.
4:18 So again we've got our game,
4:20 this will be v1.0 of RPS.
4:25 We'll go ahead and commit that.
4:28 And these let's say we want to ignore again everything under .idea.
4:33 So ignore everything under that in this repository,
4:35 which means it goes into the git
4:37 ignore. And then if I check,
4:41 push, it's going to commit this and it's already has one pending change that will
4:45 push two changes up to the repository.
4:50 Quick refresh shows that they are there right now.
4:54 So ignore the idea, Version 1.0 of the game.
4:57 And then just the read me.