Python for Absolute Beginners Transcripts
Chapter: Organizing and reusing code with functions
0:00 It's time for a game and in this chapter
0:02 as well as in the next couple of chapters, we're
0:04 going to focus on a game you probably already know.
0:07 Rock, paper, scissors.
0:09 Here's a little graphic from wikipedia that talks about it
0:11 so, you have a hand symbol, the two fingers up mean scissor
0:15 the flat hand means paper and the fist means rock.
0:19 And they have this relationship that paper beats rock
0:22 rock beats scissors, scissors beats paper and of course
0:25 you can tie.
0:26 Or you can pick one where one of the players wins.
0:29 So we're going to build this game and we're going to actually
0:32 build it over the next couple of chapters
0:34 layer by layer. Starting out really simple
0:37 and then we're going to convert to reusable more clean code
0:40 with functions. Then we're going to apply really interesting
0:42 data structures to make it way more useful and generalized
0:46 as well as simpler and we're going to have it read and
0:49 write files so that it has things like leaderboards
0:52 and other config extensibility things.
0:55 So users can create their own types
0:58 of rock, paper, scissor games and so on.
0:59 It's going to be really, really fun.
1:01 But this is more than just a game.
1:03 Maybe you're familiar with karate kid, here we have Daniel
1:06 and Mr. Miyagi and Daniel's learning to become
1:09 a karate black belt or something, I'm not sure
1:11 if he even gets a belt.
1:13 But He's studying for Mr. Miyagi and
1:16 he wants to learn karate and fighting and all
1:18 Mr. Miyagi asks him to do is, wax his car.
1:20 Wax, on, wax off if you remember that.
1:23 So he does it over and over and it seems like
1:25 what are we doing, isn't this like, this is not what
1:28 I want to be studying.
1:29 I want to be doing a real thing
1:30 I want to be doing amazing stuff, I want to be fighting
1:33 or defending myself or whatever his goals were
1:35 in that movie.
1:36 And here he is just waxing a car. It turns out
1:40 much like the practice he got doing
1:42 wax on, wax off of the car, it taught him sort of
1:46 muscle memory of some of the karate moves.
1:48 Building this game is actually going to dive into
1:50 many, many really important programming concepts.
1:53 Now what you'll learn from this game, well it is a game
1:56 will let you build software for banks, websites
1:59 all sorts of stuff.
2:00 Obviously there's extra details you need to learn
2:02 for those other systems but this is a really
2:04 good foundation that we're going to get
2:06 out of this rock, paper, scissor game.
2:07 So I hope, hopefully you're excited learn it and build it
2:11 and play it because it's going to be allot of fun
2:12 and I think you'll be surprised what we come up with
2:15 in the end.