#100DaysOfCode in Python Transcripts
Chapter: Days 13-15: Text-based games (and classes)
Lecture: Demo: Initial project structure

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Alright, let's write some code.
0:01 So, we're going to begin this first part of our demo
0:04 by simply creating the general skeleton and flow
0:07 of our application.
0:09 We're not going to actually do anything with classes at all,
0:11 but we're going to get it ready to.
0:13 So, let's come over here and add a new Python file.
0:16 I noticed there were none at all,
0:18 and I'll just have this called program.
0:20 In here we're going to define a main method,
0:24 oh, I've got to to configure this, hold on.
0:30 Alright, now Python is happy.
0:31 So, what we're going to do is
0:32 we're going to do a little print the header
0:34 and that's just going to show these methods
0:36 don't exist yet,
0:37 but just think about the ideas.
0:39 Then we're going to run the game loop, okay,
0:43 and it's going to go around and around and run.
0:45 This concept of a game loop you'll find out in a second,
0:47 but let's put this print header here first.
0:52 Now maybe we'll put something more interesting here later,
0:54 but for now, we'll just do like a little line
0:57 and something like, wizard game.
1:01 Or, something like that, that should look pretty decent
1:03 and maybe a little divider there, as well.
1:06 Then, for our game loop
1:10 we're going to come in and we're basically
1:12 going to create the various concepts in the game.
1:16 We'll create a number of creatures,
1:17 we'll create our hero,
1:18 then we'll just say while true,
1:21 we'll sort of like ask the user for action.
1:26 Then we'll say like if win or exit,
1:30 and we'll just brake out of this loop
1:32 and then we'll just say print, goodbye.
1:35 Alright, so we just go around and around,
1:36 and keep asking the user to sort of control the hero.
1:40 Do you want to attack?
1:41 Do you want to look around?
1:42 Things like that.
1:43 Now, there's a bunch of writing here
1:44 that is actually not super interesting
1:47 for you to watch me type it out.
1:49 So, let me just paste a little bit of code here
1:51 to a more full featured version of what I just described.
1:54 There we go.
1:55 So, now we're going to come in
1:56 and we're going to create our creatures.
1:58 We don't have any creaturs yet,
2:00 remember we have to model those
2:01 with classes and that's one of our primary goals.
2:04 We're going to create a hero.
2:05 We're going to go around and around,
2:07 we're going to grab randomly,
2:09 choose one of the creatures to appear.
2:12 We're going to print out details
2:13 about the creature that has appeared.
2:15 Here's the input asking the user
2:18 do you attack, run away, or look around.
2:20 Like what is your hero going to do, and then we just check.
2:24 Do they type A?
2:25 Do they type R?
2:26 And so on.
2:27 So, this not super interesting yet.
2:29 I'll put a little pass here to show it's not upset
2:31 with that section there.
2:33 It's not super interesting yet,
2:35 because we don't really have a hero.
2:36 As you can see right here, and we have no creatures.
2:40 So, let's go and model that next.