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

Talk Python's Mastodon Michael Kennedy's Mastodon