Learn Python with Talk Python's 270 hours of courses

#278: Teach kids Python with real programming and fun games at Code Combat Transcript

Recorded on Monday, Jul 20, 2020.

00:00 If there's one message I've been pushing across all of the Talk Python episodes, it's that programming is a superpower.

00:06 Rather than all of us abandoning what we're interested in and becoming CS majors, we can take our passion or our expertise and 10x it with a little programming skill.

00:15 In that case, we should be teaching kids fluency in programming at a younger age.

00:20 And yet, almost every platform or example meant to do so pulls its punches.

00:24 We teach kids programming concepts, but not code itself.

00:28 We'll use these blocks because text-based programming, that's a bridge too far.

00:32 But it's not, and that's why I'm excited about CodeCombat.

00:36 It's an online coding platform that uses real Python syntax to guide your hero visually through a dungeon full of challenges.

00:43 Yet the editor in customized error messages means this is approachable for kids before they can even reliably type.

00:49 On this episode, you'll meet Nick Winter, one of the co-founders of CodeCombat.

00:53 There's a lot of philosophy behind the tool and technology to make it kid-friendly and real Python at the same time.

00:59 Oh, and it's running Python in the browser.

01:01 This is Talk Python to Me, episode 278, recorded July 19th, 2020.

01:20 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.

01:27 This is your host, Michael Kennedy.

01:28 Follow me on Twitter where I'm @mkennedy.

01:31 Keep up with the show and listen to past episodes at talkpython.fm.

01:34 And follow the show on Twitter via at Talk Python.

01:37 This episode is brought to you by Linode and us.

01:41 Have you tried to learn Python but got stuck or lost focus?

01:44 We know how it feels to try and jam fact after fact, loop construct after turn hair expression, into your head.

01:52 At best, it's boring.

01:53 At worst, it can turn you off programming altogether.

01:56 That's why we built our course, Python Jumpstart by Building 10 Apps.

02:00 This course guides you through carefully planned applications.

02:03 It starts simple but progresses to quite real apps.

02:06 Best of all, you won't be learning dry facts.

02:09 You'll be learning like the pros do by building real applications and learning in context.

02:14 If you want to start building with Python, just visit talkpython.fm/course to get started.

02:20 Nick, welcome to Talk Python to Me.

02:22 Oh, thanks for having me.

02:23 Yeah, it's great to have you here.

02:25 Your platform, Code Combat, is something I've been a fan of for a while, ever since I came across it.

02:29 So I'm looking forward to talking to you about it.

02:31 Before we get into that, though, let's start with your story.

02:33 How did you get into programming?

02:34 My dad was an engineer at IBM doing custom chip designs for a long time.

02:39 And so he had the first big open source home automation project written in Perl.

02:45 And he would even have neighborhood kids around mentoring them in coding and all this sort of stuff.

02:50 And I never tried it.

02:51 And so that's not how I got into coding.

02:53 You had this chance, but you didn't take advantage of it.

02:56 I don't even know.

02:56 Maybe I just thought that was like a dad thing.

02:58 I don't know.

02:59 But like, I never tried it.

03:00 I was doing all this other stuff.

03:02 My mom was more on the artistic side, writer.

03:05 And I was trying all the writing really terrible poetry, all that kind of stuff.

03:08 And so when I got to college, I had no idea what I was going to do.

03:11 And I tried everything.

03:13 And chemistry class, maybe not so much fun.

03:16 Poetry class, pretty fun.

03:18 Tried a coding class by luck.

03:20 And I was like, damn, this is so boring.

03:24 And but that was like the first, you know, part of the semester, right?

03:28 Because we're coding in Java.

03:29 And, you know, at this year, I've had like, I've had like billions of years of advanced mathematics

03:35 class.

03:35 And it was like, all right, we are going to do simple arithmetic in Java.

03:38 And it's going to be really hard.

03:40 And I was like, why would I need to make a computer do something that I already know how

03:45 to do since like 20 years ago?

03:46 But like, and we got to the end of that first semester, though.

03:50 And although it was kind of boring, it was really easy for me, not so for necessarily all

03:54 my classmates, just the way that it was taught, typical failure rates in computer science programs.

03:58 And we get to the end.

04:00 And then there's this project.

04:01 And the project is a rabbits and foxes simulation.

04:04 And I was like, okay, got coding it up.

04:07 It's kind of cool.

04:08 I can say these colored squares on the screen.

04:10 There's the red one.

04:11 There's the, wait a minute.

04:12 Could I make another one?

04:14 And of course, this was a sample project, which almost everything done for you so that

04:17 you get anything done.

04:18 And I figured out, I was so proud.

04:19 I put in zombies.

04:21 And so now there's the black squares on the screen.

04:23 I'm like, wait, they're infecting them.

04:24 And there's undead rabbits and zombie kings.

04:26 And I was like, wait a minute.

04:28 You could just make stuff with code.

04:31 You could just do whatever you want.

04:32 It's creative.

04:33 Wait, oh, this is cool.

04:34 I'm into that.

04:34 So then I got into it.

04:36 So this college class, finally, I got lucky with like the last project of that first semester.

04:41 And then I was hooked.

04:42 And so we had that whole computer science undergraduate thing in Java.

04:46 And I was like, man, Java is kind of terrible.

04:48 We got into Scheme.

04:49 We're doing a lot of that.

04:50 I was like, this is great.

04:51 And then we got into Python because I actually had to start writing some real software.

04:55 And that was where you kind of put together a lot of the high level elegance and power

05:01 that you would have from something like a Scheme.

05:03 But you don't have to be a genius hacker, which at that point, I definitely wasn't to like

05:08 actually write something to put some UI on the screen and get people to use it.

05:11 So that's awesome.

05:12 And you didn't have to have like 50 closing parentheses.

05:14 There, I remember doing a lot of closing parentheses and it being real, real messy.

05:22 Scheme is such a crazy language.

05:25 Scheme is less.

05:26 I took that as well in college as like my CS credit or whatever.

05:29 And it kind of drove me crazy.

05:31 But yeah, I feel like hearing your story that it's pretty common that the way programming is

05:38 taught in universities, especially at the low levels, I think it's like, we're just going

05:42 to teach you the facts and you have to wait four months before you can actually do anything.

05:48 And you're just going to have to have this delayed gratification or you have to be motivated

05:54 beyond the near term, right?

05:56 Like I'm going to spend a whole week doing loops.

05:58 I don't really have anything to loop over.

06:00 I don't care about looping, but we're doing loops.

06:03 And then the next time we're doing functions and we're doing types and then we're doing

06:05 interfaces.

06:06 And like it's taught is just like a series of facts.

06:10 I feel like that strips out a lot of people because they don't get to have that experience

06:14 you had at the end of the class until the very end.

06:17 And by that time, a lot of people are like, yeah, no.

06:19 Well, yeah.

06:20 And it's even worse than not having anything to loop over because they do give you something

06:24 to loop over.

06:25 And it's math.

06:26 It's like we're doing arithmetic here.

06:27 Or like it's the terminal stuff.

06:30 Like let's print some strings, but like the length of the string.

06:33 And like that doesn't get you going.

06:36 That's not what's getting most of these kids out of bed.

06:38 It's not what's getting like really matters to folks.

06:40 And so it's sending the message, hey, coding, computer science.

06:43 This is like math, but geekier.

06:45 So, you know, if you're not a math person, stay away.

06:48 That is wrong to me.

06:49 Yeah, I agree.

06:50 Because there's a lot of creative aspects.

06:52 There's a lot of amazing things that you can build.

06:55 I think it's a little bit less so now with all the mobile apps and like applications

07:00 have really infused society or come across like deeply.

07:05 They're all over society now and they're somewhat beautiful.

07:08 A lot of times 10 years ago, that wasn't even the case, right?

07:12 Well, but the thing that you're starting off with is rarely going to be a beautiful mobile

07:17 app that you care about, especially if you're in a formal learning environment.

07:20 Right.

07:21 Maybe it's worse.

07:21 Maybe it's you look at Instagram, that mobile app.

07:25 You're like, I want that.

07:26 They're like, no.

07:27 What you're going to do is you're going to implement the quick sort algorithm in scheme

07:31 by hand over these numbers.

07:33 Why would I do this?

07:35 I would never do this.

07:36 For some of us, it kind of gets you going.

07:37 I liked that part of it, but, you know, I didn't know that I would like that.

07:41 And I never thought like, hey, let me give this a try.

07:44 Yeah, I think ultimately people who are really into it do get to where they like that.

07:47 But I feel like you've got to get to the, hey, this stuff is awesome sort of place.

07:53 And then you can start to appreciate and dig into those things.

07:56 So if we think then what happened next.

07:59 So I was in college and I was learning all this coding stuff and I was also learning math and

08:04 I was learning Chinese and I was reading Paul Graham essays and Paul Graham essays have a

08:10 lot of great stuff in there about your high level languages.

08:12 But they also have this entrepreneurship stuff, which I had never heard of.

08:15 I have been coming for like the scheme talk and the list talk.

08:19 And he's like, he's got one of these where he says, oh, you know, you shouldn't have a job.

08:23 You weren't meant to have a boss.

08:24 You should just start your own startup and do your own thing.

08:27 And smart young people should just start their own startups.

08:29 And I was like, yeah, man, that sounds great.

08:32 I don't want a job.

08:32 I'll just start my own startup.

08:34 So I went to my roommate and I was like, hey, hey, hey, we've got to start our own startups.

08:37 He program says, who is the what?

08:39 No, I'm doing my econometrics homework.

08:41 So I get my Wall Street job.

08:43 And so stop bothering me.

08:44 And I'm like, no, no, no.

08:46 I pestered him until he's finally fine.

08:48 If you can think of something that's a good idea that like as a business, then we can maybe

08:53 give it a shot.

08:54 Until then, Wall Street, econometrics, go away.

08:57 And so I was pondering, pondering, pondering it and had all sorts of really stupid ideas.

09:03 And I went to China as I was learning Chinese for a few weeks.

09:09 And I had this really crazy experience with reverse culture shock.

09:14 And I was really sick.

09:14 And it was like four in the morning.

09:15 And I saw this other guy who was named basically the same as me.

09:20 And he's the only other like Chinese and computer science student in my same year.

09:23 And like randomly met him in Beijing.

09:25 And I had no idea he was going to be there.

09:27 Like Beijing is a city of like 20 million.

09:28 Yeah.

09:29 And so 4 a.m.

09:29 We're getting up to go to the Chinese McDonald's on the way out to fly to the airport.

09:33 I was like, what is going on?

09:34 I see him.

09:35 He's writing Chinese characters.

09:38 On his Nintendo DS practicing it at like the stroke level.

09:42 So he's got this handwriting recognition.

09:43 And I'm like, man, that's so cool.

09:45 I need to learn Chinese characters like that.

09:47 And he's like, what?

09:47 No, I'm playing trauma surgery.

09:49 I'm like a Japanese surgeon in combat, like saving patients.

09:52 I'm like, oh, I thought you were practicing Chinese.

09:54 Oh, wait a minute.

09:55 I do want to practice Chinese like that.

09:57 So I, and that was the first kind of Python program, right?

10:01 We got into it there because I was like, hey, I need to write some software that makes it

10:06 so that you can write characters in Chinese at the stroke level and like practice that

10:11 way.

10:12 Because it takes a lot of learning Chinese characters to really learn Chinese.

10:15 And that's like the hard part.

10:16 So it's all that part.

10:17 Like, hey, that's got to be a business there.

10:18 People pay for that, right?

10:19 I pay for that.

10:21 Well, I mean, I don't have any money, but I would, I would use it.

10:23 And so you can see we're thinking much more from the technology aspect at that time than

10:27 the business aspect.

10:28 But we say, hey, there's a problem.

10:29 We can solve it.

10:30 And, you know, we reach for the real practical language here.

10:34 We're not pulling Lisp off the shelf where we're going into Python.

10:37 And I hardly knew it.

10:38 So the first Python program that I wrote basically was this character editor that would like start

10:44 to form the data layer for this Chinese language learning app.

10:46 And with that, I was able to convince my roommates to kind of jump and not go and work in Wall

10:51 Street, which is great because that was 2008.

10:53 And my roommate was actually not a terrible time to go to Wall Street.

10:57 Then lost that job.

10:58 Yeah.

10:58 He would have had a good two month run there maybe.

11:01 But yeah, yeah, yeah.

11:03 Yeah.

11:03 So we, then we're just some guys hacking in our house and working on this thing, see if

11:08 we can get it going.

11:09 And, you know, even though we were really kind of terrible coders at that time, but, you

11:15 know, Python was flexible enough that we didn't get bogged down in architecture.

11:19 And we wrote that we had, you know, at the time, we had, you know, at that time there was no iPhones.

11:22 It was like welcome tablets and, you know, handwriting recognition, learn some Chinese,

11:27 hack on some code.

11:28 And, you know, that took off.

11:30 So we made the, and, you know, the backend we did in Google app engine with Python and

11:36 Django.

11:37 And we kind of got it going.

11:38 We got profitable.

11:40 We made the number one app for foreigners to learn to write Chinese characters and off

11:44 to the races.

11:45 So the first Python program I wrote ended up, you know, pretty good, man.

11:48 That's pretty awesome.

11:49 That sounds like a useful app.

11:51 And I think it captures a little bit of what you've done with code combat as well.

11:57 in the sense of, oh, I don't want to just sit down and learn this rote memory practice type

12:03 of thing, but I want to learn it in the context of play.

12:05 If we think of kind of the transition from Skritter, which is the Chinese character running out to

12:11 code combat, it was the same founding team.

12:14 And we had, we'd been running it for five years and we said, Hey, well, you know, we've made enough

12:19 money to not need to work again.

12:21 Let's retire.

12:22 And I made it about nine days.

12:24 I was like, guys, I'm so depressed.

12:26 We got to do another one.

12:27 And they're like, okay, what should we do?

12:28 We had some really stupid ideas on there too.

12:30 We're like invisibility cloaks that actually work.

12:32 Let's do it.

12:33 And they were like, no, no, what do we know guys?

12:35 We know how to make ed tech teach hard things.

12:37 Okay.

12:38 Cause we take this language learning approach to learning Chinese characters.

12:42 Obvious.

12:43 It's a language.

12:43 You should do that.

12:44 And then we thought, okay, coding.

12:46 That's something we cared a lot about.

12:47 Me and my other co-founder, you know, he had also learned in college.

12:50 We both wished we'd learned earlier.

12:52 And we're like, okay, well, yeah, those CS classes could have worked a lot better if

12:58 we kind of built the fluency first, as opposed to kind of the intensive learning.

13:03 We do the extensive learning where it's easy, just right at that zone of proximal development.

13:07 You're going to go for hours in flow state as opposed to go for half an hour and, you know,

13:12 rage kick your segfault computer out of the window or something.

13:16 And so we're like, all right, well, if you can build the convert, if you can make it more

13:21 like language learning than like math, where you're having a conversation with the computer,

13:24 then I mean, language learning, if you have a kid and you have a native speaker and they

13:30 have a one-on-one conversation and the native speaker can bring it down to the kid's level,

13:35 like, obviously that kid is going to learn that language.

13:38 It's not a question of if they're like a language person, like people think of themselves as math

13:42 people or not math people.

13:43 Like that would be absurd to think, oh, I'm not a Spanish person.

13:46 I can't, I can't learn Spanish.

13:47 I mean, that would mean something else, right?

13:49 I'm not from Spain.

13:49 But so we were thinking, okay, if you use these methodologies where you have just like native

13:54 speaker conversation with the learner and you can bring it down to the learner's level,

13:58 then that should work, right?

14:00 If computer science, the hard part of that is actually the coding part, as opposed to

14:05 the science part where you, all these other things are pretty easy to explain in lectures

14:09 or there's not all that much science in what most people do with it either.

14:12 It's kind of the craftsmanship and being able to express your thoughts to the computer.

14:15 Well, if we have, we need a native speaker, well, who's the native speaker of coding?

14:20 Well, it's the computer already.

14:22 Like you don't need a human for that, but the computer only speaks computer language.

14:28 So you, you, you get the beginner coming in there and they're saying, you know, they're

14:32 trying to print out their hello world, but you know, they're like putting some extra spaces

14:36 in there, whatever they do.

14:38 Of course, they're going to make some mistakes.

14:39 Normally that syntax error, unexpected token.

14:42 And they're like, yeah, what does this mean?

14:44 And they need someone to explain.

14:45 Right.

14:45 I like, I forgot the comma, but it knows what I mean, right?

14:48 Like, no, it doesn't know what you mean.

14:50 It has zero forgiveness.

14:51 Yeah.

14:52 No forgiveness.

14:53 And it's because all of the code engines out there.

14:55 And I mean, I love the Python interpreter, but like it, like everything else was designed

14:59 for professional software engineers to use by professional software engineers who have

15:04 this curse of knowledge.

15:05 And they're like, oh yeah, this makes sense without ever thinking like, what if it didn't

15:10 make sense?

15:10 What should you say?

15:11 And so not at all suitable for beginners, but that's every text-based code language engine

15:16 out there that I know of, right?

15:18 Error messages are quite arcane.

15:20 And that's a huge problem in learning to code because you need someone to interpret.

15:24 So if you did something as simple as seemingly simple as make all the error messages make

15:29 sense, then that'd be a huge step towards having that conversation flow.

15:35 So for example, in CodeEngine, in CodeCombat's CodeEngine, we have written a lot of codes

15:39 so that, you know, no matter where in the stack the error is, whether this is a syntax error,

15:45 a linting error, it's a runtime error, it's maybe not even an error, but it's just a logic

15:49 error and could be valid, but we happen to know it isn't for this level that you're trying

15:53 to do.

15:53 Then we'll say beginner-friendly error message.

15:56 So it will say, don't put a space, or that should be a capital R, not a lowercase R.

16:01 Did you spell, you said dwan instead of down, you should probably fix that.

16:06 Yeah.

16:07 And everything else is like syntax error and expected token or, you know, undefined method.

16:11 Like, those are not words.

16:12 So when we came at it with this language learning perspective, then you have the native speaker,

16:19 which is the computer, get it to speak the beginner's language.

16:23 And then, you know, people are just off to the races.

16:25 Like, every mistake they make is a teaching opportunity.

16:27 They solve it in 10 seconds that it takes them to read the error message and edit the code.

16:31 And that is so much faster.

16:33 It's that conversation.

16:34 So if our insight for teaching coding was you have that conversational mode as opposed to

16:41 that intensive kind of abstract, geeky instruction kind of mode, and then you have to make it mean

16:48 something like you were saying to the learner.

16:51 And what do you, you know, if we're targeting kids, especially here, what do kids care about?

16:55 They want to make and play games.

16:57 You want to make websites and apps.

16:59 And those are the things that matter.

17:00 And so if you can get them learning to code and making that stuff quickly, then that has

17:07 meaning not just for your geeky boy who sees themselves as, you know, a coder someday, which

17:12 is a huge minority of the population.

17:14 It's more like basically everyone because 97% of kids play video games.

17:17 So like, what was I doing instead of learning all this coding stuff from my dad?

17:22 Well, I was just playing video games the whole time.

17:24 And so if I had had a video game that taught me to code, maybe we could, we could get out

17:29 on that a little earlier.

17:30 And same thing for co-founders, right?

17:32 So we're like, can you make it so that you're just playing a game and not like gamified where

17:38 you just get badges and points?

17:39 Because with our first business, Skritter, you know, you would get, the users would say,

17:44 hey, it's so great.

17:45 It's like a game.

17:46 And we're like, no, it's a hardcore learning.

17:47 So what do you mean?

17:48 It's not like a game at all.

17:48 I'm like, well, there's, you know, you go fast, there's animations, and then you get

17:51 points.

17:52 So like, no, no, no, there's no points.

17:53 What do you mean points?

17:54 There's no points.

17:54 Well, the number of characters, you know, it's kind of like points.

17:56 There's a graph.

17:57 A real game would have this, this, this, this.

18:00 And they're like, that's great.

18:00 When are we going to get those features?

18:02 We said, this is a tiny market.

18:03 And we're already number one.

18:04 We're not going to build that.

18:05 Wait a minute.

18:06 We could build that for this other market, which is much more starting to learn about business

18:09 and markets here.

18:10 This portion of Talk Python to Me is brought to you by Linode.

18:15 Whether you're working on a personal project or managing your enterprise's infrastructure,

18:19 Linode has the pricing, support, and scale that you need to take your project to the

18:24 next level.

18:25 With 11 data centers worldwide, including their newest data center in Sydney, Australia,

18:29 enterprise-grade hardware, S3-compatible storage, and the next-generation network, Linode

18:35 delivers the performance that you expect at a price that you don't.

18:39 Get started on Linode today with a $20 credit, and you get access to native SSD storage, a 40-gigabit

18:45 network, industry-leading processors, their revamped cloud manager at cloud.linode.com, root

18:51 access to your server, along with their newest API and a Python CLI.

18:55 Just visit talkpython.fm/Linode when creating a new Linode account, and you'll

19:01 automatically get $20 credit for your next project.

19:03 Oh, and one last thing.

19:04 They're hiring.

19:05 Go to linode.com slash careers to find out more.

19:08 Let them know that we sent you.

19:11 Could you even do it?

19:13 And so that's where we spent years and years in the R&D phase, building up code combat, seeing

19:19 if we could get this interpreter to work, seeing if we could get the game engine to work, seeing

19:23 if you could get those two things to work together.

19:26 And that was just a lot of hacking and hacking and hacking, like we do, just sitting in my

19:30 succession of tiny, now in the Bay Area apartments, and eventually got something going, eventually

19:35 got those kids not just in JavaScript, which runs in the browser, but you have it in Python

19:40 too, because the code engine supports these other front-end languages.

19:44 Which is such a nice learning language.

19:46 Oh, it's the best.

19:47 I think Python's special in that regard, in that it's good for learning, but you can build

19:52 professional things like Instagram or whatever else, right?

19:58 Pinterest, you name it.

19:59 It spans that spectrum, which I think is one of its superpowers.

20:03 Oh, it's so fantastic.

20:04 And if you look, depending on how you count, Python and JavaScript are the top two languages.

20:10 Maybe some ways you count Java gets in there in the top three.

20:13 But to have Python, which is so great for learning, and also so great for everything else, also

20:19 be so popular to where it could be the default choice if someone doesn't have a reason that

20:23 they're coming in to learn something else, like, hey, try Python.

20:25 I think we haven't measured this super exhaustively, but I think it's about a grade level easier

20:30 than JavaScript.

20:31 And for what we're doing, Code Combat, it's all basically the same stuff.

20:35 You're not doing any language-specific things in the beginning, but it's the syntax and your

20:40 curly braces versus your colons and indentation.

20:43 Like, you know, it's a whole year worth of, you know, kid development on average, thereabouts,

20:48 easier to do it in Python.

20:51 Yeah.

20:51 Yeah.

20:51 So you can start sooner.

20:52 And yeah.

20:54 So let's, I don't think we formally talked about what Code Combat is.

20:58 We talked about the history, which is incredible.

21:00 I had no idea about it.

21:01 But you tell people what Code Combat, like, what's the experience when you go there as a learner?

21:08 You talked about playing it as a game.

21:09 Like, what is it?

21:10 Yeah.

21:10 So it's the game for learning how to code.

21:13 We can qualify that a little bit to say it's aimed at kids age 8 to 18, basically as soon

21:18 as they can type.

21:19 Not to say that only kids play it.

21:21 We have a lot of adults play it.

21:23 We just aren't marketing it in that audience.

21:24 Still, what are the best ways to learn to code from scratch?

21:28 And so you get in there, you're playing a game, you're controlling your hero.

21:32 In the beginning, you're kind of escaping from dungeons, solving mazes, killing ogres, and

21:37 you're building your armies.

21:39 And it progresses from there.

21:40 So dungeon crawling role playing game in the beginning.

21:43 And then as you learn more pieces of code, because everything you do in the game, you're

21:48 coding, right?

21:48 You can't even move your hero without coding some stuff.

21:51 But as you go through the game, you get more items.

21:54 And so this could be a new sword, a shield, a pet, whatever it is.

21:58 Those things give you new APIs and new control structures.

22:02 And so as you progress through this really natural game-based learning progression of loot and

22:09 XP and leveling up and new challenges, it's introducing and making you use and learn and

22:15 practice different coding concepts and new abilities.

22:18 So you're not just leveling up your hero, you're leveling up your knowledge of coding.

22:22 You can do that in Python, JavaScript.

22:24 We have CoffeeScript, Lua.

22:26 In China, we have C++.

22:28 Java could be turned on at any point.

22:30 All those things go into this code engine because what we're really trying to do is be the best

22:35 way to learn to code.

22:35 And so whether it is magic craziness over in the code editor, whether it's kind of deep

22:42 dive into the code engine, whether it is kind of custom tuning on the game engine and

22:46 the levels, whether it's just like a look at the overall pedagogy.

22:50 Everything is trying to get the kids to learn coding and computer science, both more engagingly

22:57 and more efficiently than otherwise they would be doing.

22:59 So that is what it is.

23:01 We do that for kids at home, which of course doesn't need to be kids, but it's usually kids.

23:06 We'll also now, a new thing we're doing is we will give you a coding teacher on video call

23:12 to help you go through this stuff as well and maybe explain a little bit more about the concepts

23:16 around it.

23:16 And then we also have it in the school.

23:19 So the computer science curriculum, the new teacher needs to run a full coding class, full

23:24 computer science class, even if they don't have any coding background.

23:27 Because you have the self-paced software.

23:29 I mean, each computer is kind of doing a lot of the instruction in dialogue with the student.

23:34 And then we provide all the curriculum and lesson plans and resources for the teacher

23:38 to run that class.

23:39 And it's been doing pretty well lately just because with COVID-19 and all the school shut

23:44 down, you need something that's distance learning friendly in the schools that kids might actually

23:48 want to do, even if they have no better options when stuck in the classroom.

23:53 Now the whole internet is right there on that same computer.

23:55 So you got to engage them where they are.

23:57 And I think it's super engaging.

23:58 So let me try to talk a little bit about what I think the experience feels like.

24:03 And it's definitely like what you said.

24:04 You have these different, you call them worlds, right?

24:07 Yes.

24:07 In the home version, you would progress from the dungeon world to the forest world, the desert,

24:11 the mountain, the glacier.

24:13 And the kids really, really are excited about the volcano, which doesn't exist yet.

24:17 But it's kind of like there to tease them.

24:19 But if you got all the way to the glacier, like, you know, you probably all plus code the volcano

24:24 because it gets pretty advanced.

24:26 Yeah, for sure.

24:26 So what you do is you go into these worlds and then each world has maybe 40 or so little

24:34 puzzles or challenges, right?

24:36 So you, if you go to like one here, if I click on it, it'll say, okay, I'm going to descend

24:42 further into the dungeon.

24:43 So what I need to do is use a loop to navigate.

24:45 And then it talks about the lessons I'm going to learn.

24:47 I'm going to get arguments, basic syntax and while loops.

24:49 And then when you go in there, you get your little character.

24:52 And this is like a visual thing, right?

24:54 It's not like a mud or a text-based game.

24:57 It's like literally the characters are there, which is super cool.

25:01 And then when you go do the programming, and this is the thing that I thought was really

25:05 the magic of what you guys have built is that you've got this nice code editor that's true

25:12 Python, right?

25:13 Or the other languages.

25:14 But I think the Python one is extra special.

25:16 And when you go there, you type Python code.

25:19 But the editor has a special kind of autocomplete.

25:22 I think you would say that is incredibly beginner friendly.

25:27 So like you might have to type hero dot move, right?

25:30 Parenthesis, parenthesis.

25:32 And if you just type the word R or RI, it'll like autocomplete hero dot move, right?

25:39 It'll complete the whole thing.

25:40 So you can just type a little tiny bit of what you want.

25:42 And I think that that's so special because you don't have to form it all.

25:47 Like if you misspell hero and you type dot in a regular editor, you get nothing, right?

25:53 Right.

25:54 Or if you just type the word right, it's like, oh, what you actually have to do is

25:56 hero dot move, right?

25:57 So I feel like it's incredibly supportive for writing real code rather than, you know,

26:04 I think there's this trade-off that people always make.

26:06 Like, oh, you can do like a blocky scratch language where you drag the blocks around and

26:09 you get like a looping block and you drag the blocks into the looping block.

26:14 And it's like, that's maybe programming thinking, but that's far from programming.

26:18 Yeah.

26:19 Real code.

26:19 Whereas this, I feel like it's almost as supportive, but you write real code and you see it actually do things.

26:27 Well, there's definitely a lot more to writing, even in CoCombat, writing this text-based code,

26:32 whether it's Python, JavaScript, whatever, than to dragging the blocks around in something

26:37 like Scratch or Blockly.

26:39 Those are really great introductions to computational thinking, I would say.

26:43 And you can actually write a bunch of stuff in there that gets fairly advanced.

26:47 The problem is you do not learn some of the key skills by doing that.

26:53 So there are some things that like, yeah, this is just as good for conceptualizing how a loop

26:57 works or variable or something like that.

26:59 But you are not building any of the fluency with formal syntax that you're going to need

27:04 eventually.

27:05 And you're not building most of your facility with debugging.

27:09 And, you know, a few other things there.

27:11 So the problem comes when kids tend to move from those drag and drop block-based visual programming

27:17 things to text-based.

27:19 And they've actually learned a lot of coding, computational thinking concepts.

27:22 But they start facing that blank editor page.

27:25 They try to type something in.

27:26 They don't know the syntax.

27:27 And they feel like they've learned nothing.

27:29 And a lot of times they rage quit out of coding forever at that moment.

27:32 And really, they just had a few extra things to learn.

27:35 And then they can go on and express those concepts they had gotten practice with.

27:38 But that transfer is pretty hard to show.

27:40 And people always avoid starting there because it's so complicated.

27:44 The teachers will have such a hard time with like setting up Python or JavaScript and then

27:50 debugging it.

27:51 with this environment being so supportive in the editor, like totally geared for, I'm going

27:55 to help you write that line of code from, you know, 10 options that you might potentially

27:59 write.

27:59 It makes it entirely doable for an entirely different level of learner.

28:04 Yeah.

28:05 So the, we had learned a lot from Brett Victor's learnable programming essay when we were starting

28:10 out.

28:11 And that we tested out a lot of his more advanced things too, like time travel, debugging, and

28:16 all this showing the variable state.

28:18 It turns out a lot of that stuff is not what the learner needs in the very beginning.

28:21 Although really great thinking.

28:23 And I'd love to get that some more of that turned back on for more advanced players someday.

28:27 But the things that you really need to lower that hurdle of formal syntax are just being

28:35 incredibly forgiving, but sensitive to the kinds of mistakes that people are making.

28:38 And this goes way beyond what we would thought it would ever come to in terms of what you need

28:43 to do in that text editor so that students aren't bleeding all over themselves and cutting

28:48 themselves on sharp edges.

28:49 So for example, let's say that you, like you mentioned with the autocomplete, you got to

28:54 do the fuzzy ordering because they're typoing all over the place.

28:57 So this fuzzy search through your options, and this would never work in a real code editor

29:02 because you've got hundreds, if not thousands of things that you could autocomplete.

29:07 It's not going to be a great experience if you're starting to pop up all these options.

29:11 But when in CoCombat, we can start them off from a set of four APIs and progress adding one

29:18 or two at a time from there.

29:19 So they always have a sense of what's available.

29:21 And then they learn just how many characters or digits they need to type in order to activate

29:25 those.

29:26 And that's that smooth progression.

29:28 Okay.

29:28 So we knew we were going to need something like that.

29:29 What we didn't know is stuff like if someone is typing an argument, like a number or a string

29:36 or something like hero to attack Brack and Brack is the name of the ogre.

29:39 Every kid out there, they're going to type, you know, maybe hero dot, maybe HA, maybe ATT.

29:45 They're going to select the attack.

29:47 Now you, you got to highlight the inside of the quotes for them, because if they just start

29:53 typing, they're not going to type the quotes.

29:54 They're going to delete them.

29:55 They're going to get one off.

29:56 Those kind of errors are kind of hard to fix.

29:58 They're going to type, replace the enemy name with Brack.

30:01 Okay.

30:02 They're probably going to do it with lowercase.

30:03 So you have to fire a message that says, Hey, that should be an uppercase B.

30:06 Leave off the quotes.

30:08 Probably all those kinds of things you've got to detect, which normally parsers have a hard

30:12 time.

30:12 They're like, Oh, I don't know any sort of code here.

30:14 Like the ending terminus of this string constant literal blah, blah, blah.

30:17 Not only their message is weird, but they don't know what line it's on.

30:20 Whereas like, we're like, yeah, we know we have all this data on where students make mistakes,

30:24 but they need to hear even what error message work.

30:26 You got to say the right thing.

30:27 You got to know for that particular program that they're trying to write, which again,

30:30 a general purpose IDE doesn't know what program you're trying to write.

30:33 So it can't do this kind of thing, but we can.

30:35 But then you have to make it so that when they type Brack and they type that K and they hit

30:41 enter, they always have the cursor inside the string and the parentheses.

30:48 So in any other code editor, bang, you got an ending quote and ending parentheses on the next line.

30:52 Like, good luck, right?

30:54 This one, we're like, you know, for a long time until they're level 30 or something like that.

30:59 We don't want them to deal with that kind of mistake.

31:02 So we're just going to move the cursor to the new line and run the code.

31:05 And so there's a ton of little things like that that you need to do because you don't

31:11 have the basic facility with text editing.

31:12 Everything from that to when they're deleting, you need to do extra, extra, extra pauses when

31:17 you delete to the beginning of the line before you start to go back and delete previous lines,

31:22 you know, highlighting the way that the indentation works so that visually they can see like,

31:26 hey, this isn't correct, like error messages that there's all sorts of things that like

31:31 could technically be valid code, but we have to point out as soon as they do it, like, no,

31:35 you can't have two while true loops in a program.

31:37 Like that is not going to make sense.

31:39 And then one thing too, like you want to have your characters in your game,

31:43 like doing important, interesting stuff.

31:46 The easiest way to get them to do more of that is to do an infinite loop where they do the thing.

31:51 But while they're coding that loop, if they don't have a blocking action inside the loop,

31:56 normally then your program grinds to a halt because time doesn't pass.

32:00 And so all sorts of crazy hackery inside the engine whereby they're writing fully general

32:06 purpose code, but we're digging in and saying, hey, does this frame have this or that kind of

32:10 continue or break or condition?

32:12 If not, we're going to add an extra like one frame blocking action to this and remove it.

32:17 If once they add an action that does something like moving or attacking or saying or something

32:21 like that, so that there's this magic behind the scenes that you need to do where it's technically

32:27 not how the code execution would happen, but it matches their mental model much, much better.

32:33 And then later when they get into conditionals, then you start to take that away and show them

32:38 what happens when infinite loop, which again, isn't just crash the browser tab.

32:41 It's like, hey, here's your infinite loop.

32:44 I disabled your hero and then he got killed.

32:46 So maybe you want to fix this by putting that here.

32:50 Your hero got tired and just like ran out of water or something.

32:53 A red X showed up under the one that didn't work.

32:56 Yeah.

32:56 So you have to do all these sort of things.

32:58 So like every sort of error makes sense, not just in the context of the code editor, but

33:03 also in the context of the game.

33:05 And you would never be able to do that if you hadn't written and have full control over

33:09 the stack and execution of your entire program.

33:11 So the custom interpreter that we've written has that like, because it will run Python,

33:17 JavaScript, you know, whatever language that you provide a runtime adapter to a JavaScript,

33:23 a Mozilla ASD.

33:25 So that abstract syntax tree gets executed by our interpreter.

33:28 And then whenever it calls out to something that doesn't exist in JavaScript or needs to behave

33:31 differently than in JavaScript, you know, that that we have a runtime language component that

33:36 makes it behave like that.

33:37 And being able to do it from, you know, top to bottom and back up lets you go in and mess

33:45 around with whatever layer of execution you need to.

33:47 This is where it like helps to actually have had that computer science class in college and

33:51 kind of understand how the compiler works.

33:52 Mess around in there.

33:54 But this stuff you have to do, you're like, oh, the student is messing around with this.

33:58 So we need to fuzzily check in this level.

34:00 We have these kind of possible strings that could work and these ones that shouldn't work.

34:04 And so over here, if they have a fuzzy match typo, we're going to adjust this error message

34:09 over there.

34:09 You need to do so much of that.

34:10 But when you do, they don't need to ask teacher.

34:13 They don't need to ask parent.

34:14 They don't need to like bang their head against the wall for an hour.

34:16 They just get it.

34:18 And that's really key for anyone learning anything.

34:21 But like, especially young kids learning something that like maybe is a little bit disconnected

34:26 from what they see other kids around them doing and wanting to do.

34:30 And, you know, that's that kind of thing if you want to get any kid into it.

34:34 Yeah.

34:34 I think you guys have done a really good job with the way you put that editor together.

34:37 It's super helpful.

34:39 It's clear that it's focused on helping beginners.

34:43 And I think the way that you put it together, you don't even have to really be able to type

34:48 in the traditional, like, you know, Cordy, don't look at the keyboard type of typing, which

34:54 you kind of need for programming.

34:55 You need to know, okay, where are the R and the I?

34:58 I mean, you got to sort of know, but like a fifth grader could totally do that, who maybe

35:02 just touch types without getting frustrated.

35:04 Because really, to solve a puzzle, you're probably doing eight, nine lines of code on a long one.

35:08 And you've a couple characters per line, right?

35:11 It's not that much of typing, but they still get that real experience.

35:15 And that's what I think is super special about what you guys have built compared to all the

35:19 other stuff that looks fun, or it's very approachable, like the blocky type languages.

35:24 But it has that big crossing the chasm sort of thing to go from there to like textual text-based

35:32 languages.

35:32 Yeah.

35:33 The amount of typing that you need will increase.

35:37 And the amount of difficulty of each level increases as you get further through the game.

35:41 So, whereas, you know, your middle schooler can probably do most of, I don't know, we have

35:47 like 600 some levels.

35:48 Maybe they can get through the first 400.

35:50 It really depends on them.

35:51 To do the later ones, they'll probably need to work through it with a teacher or a coach

35:54 just because all this stuff actually does get kind of complicated.

35:57 You're implementing some graph search algorithm.

35:59 Like, yeah, but you're 12.

36:01 So maybe let's talk about the graph search algorithm instead of just, you know, sitting out in front of

36:06 the computer and banging that out there.

36:07 But the really young kids can do the easy levels that you see where you're like, let's move

36:11 right.

36:12 Let's move up.

36:12 Let's attack the ogre.

36:13 Let's use the potion.

36:14 Let's do a while loop.

36:16 While loops, variables, function calls, not defining function, but function calls, XY coordinates,

36:24 all those things, any of these kids can get with the right kind of setup.

36:29 And then when you get into if statements, then you're thinking like, okay, well, this might

36:35 be a good stopping point for some five, six, seven year olds.

36:40 Others can totally get it.

36:41 I just saw a recorded video class that one of our teachers did with this.

36:46 I think he's eight in Hong Kong.

36:48 And the guy's like almost all the way through the mountain.

36:50 He's like commanding his armies.

36:52 He's he's doing different ways of looping over indexes.

36:55 I don't think he quite got to the module arithmetic, but like, you know, some of these kids are capable

36:59 of so, so, so, so much and they get super into it.

37:02 Talk Python to Me is partially supported by our training courses.

37:06 How does your team keep their Python skills sharp?

37:10 How do you make sure new hires get started fast and learn the Pythonic way?

37:14 If the answer is a series of boring videos that don't inspire or a subscription service you

37:20 pay way too much for and use way too little, listen up.

37:23 At Talk Python Training, we have enterprise tiers for all of our courses.

37:26 Get just the one course you need for your team with full reporting and monitoring or ditch

37:32 that unused subscription for our course bundles, which include all the courses and you pay about

37:36 the same price as a subscription once.

37:39 For details, visit training. talkpython.fm/business or just email sales at talkpython.fm.

37:46 And other kids like, hey, we'll just go and do as much as you're ready for now.

37:52 And maybe you come back to this in a couple of years as some of this abstract thinking gets tougher.

37:55 But my three-year-old, I had him start doing it.

38:00 And, you know, at that point, it's like 20 seconds to find the R key.

38:04 But then he types R and he can move to the right.

38:06 And actually meant to move to the left.

38:08 But like, you know, two minutes later, he's fixed it.

38:10 And he pressed the delete key and deleted everything.

38:12 You need to be despite all our protections.

38:14 But of course, I wrote the program.

38:16 So I'm like, OK, let's press the reset button over here.

38:18 But like he's gotten through several dozen levels.

38:21 He's five now.

38:22 So you can see how fast he goes through it.

38:23 But he gets super into it.

38:25 So it's not nearly when you're learning to code.

38:28 It doesn't matter if you're 5, 15, 25, 35.

38:31 Everybody's starting at the beginning.

38:33 And there's so few good software pieces out there to help you with that.

38:38 That it's one of the best ways, I think, to get started for anyone.

38:42 So that motivation from the game-based format is extra helpful at these young ages.

38:48 But it doesn't hurt anywhere.

38:49 Yeah, no, it's pretty cool.

38:51 Maybe we could talk through the different worlds.

38:53 So I got to figure out how to get back to it.

38:56 Yeah.

38:56 So you start off in Kithgar Dungeon.

38:57 This is the hardest piece to design because they know almost nothing.

39:01 And so you have to build up every piece of it from scratch.

39:05 And in a normal learning environment, that'd be pretty hard to design because it's just throwing

39:09 the book at them.

39:10 But in this one, we can vary the game scenario too.

39:13 So even if you need to do five or six or seven levels in a row where you're going from just

39:18 moving right up, down, left.

39:19 So maybe you do that, but there's an optional argument for how many times to move.

39:24 And then you've introduced arguments.

39:26 Now you can introduce an attack method where you can then put a string in there.

39:30 And you very slowly pace it out, but it keeps fresh because throughout you're getting new

39:35 items, you're getting new game scenarios, you meet new enemies, and different art all the

39:40 time.

39:40 So they're really thinking like, hey, I'm exploring this game.

39:43 And it does take a bunch of levels to get these basics in place.

39:47 But you get through that in the first dungeon, which people, you know, some kids are doing

39:51 this in a couple hours.

39:52 They've got, they can write code like move, hero.move down, hero.move down, hero.buildxy,

39:59 fence, 3420.

40:00 And then they have three different coordinate pairs of where they build their fence.

40:03 And they'll say, well, true, move, right.

40:05 And so that moves their hero down.

40:07 There's a bunch of ogres coming at them.

40:08 They're building fences to block off the attack.

40:10 And then they move until they get to the end of the dungeon and get the gem.

40:13 And that's the last level of the dungeon.

40:15 That one doesn't have a variable in it, but they also have variables in there.

40:18 So they can move up enemy equals hero without find your enemy attack the enemy.

40:22 They don't have any if statements yet.

40:24 So as we get into the forest and it opens up and we should have done this from the beginning

40:27 where the dungeon is still kind of more appealing to the boys because, yeah, let me get in this

40:32 dank dungeon.

40:32 It's kind of dark.

40:33 Let's hack some ogres apart.

40:34 It's not as violent as, you know, you would think from the name and the first setting,

40:38 but we sure could have made some different design decisions there.

40:41 So then you get into the forest and there's a lot of that, but there's a lot of like,

40:45 okay, let's corral our horses.

40:47 Let's build other things.

40:48 Let's defend the village.

40:49 Let's, you know, go and talk to the villagers.

40:51 And so there you're introducing if statements and Boolean logic.

40:55 You get your pet.

40:56 You got your pet earlier, but you didn't know how to do anything with it.

40:58 Now you can write event handlers and functions so that your pet can be doing stuff for you.

41:03 And you're of course increasing your kind of normal fighting capabilities.

41:07 You get to your first multiplayer arenas where you're writing your Python AI hero.

41:12 So use all your heroes capacities that you developed and you're either trying to get more gold than

41:16 the others or you're trying to just kill them or defeat them.

41:19 And, you know, from there you would move on into the desert.

41:23 And here we're doing more with numerical arithmetic.

41:26 I mean, this whole time you've been getting into the XY coordinates.

41:29 Now you can add them, subtract them.

41:31 You can do break and continue statements.

41:33 Arrays, for example.

41:34 Arrays start to happen in there.

41:36 You start to get object, a lot of it too, in the desert.

41:40 Because once you start to get arrays, you can do a lot more interesting tactics.

41:45 So you're, you know, arrays with this other stuff, let's see you implement algorithms of, you know, finding the closest enemy,

41:51 finding the weakest enemy, finding the closest weakest enemy, finding the coins, finding only the right type of coins, finding the best ones.

41:57 You're like optimizing all this stuff.

41:59 And that's really interesting for when you're kind of fighting in some of these battles.

42:03 Then once you get into the mountains and we're introducing while loops over indexes of the arrays and for loops over the arrays,

42:11 and you're starting to summon troops and you can command them to do things, you're getting into basic graphics because you're, you know,

42:18 moving in different patterns to draw the kind of the flowers that go behind you in this flower ring.

42:22 There's all sorts of like all through this time, you're constantly doing a ton of if, else, else, elif kind of statements because you need to activate all the special powers of your hero.

42:32 Whether that's to, you know, whether that's to use your bash ability or shield or cast your magic spells or go invisible.

42:37 And the kids really love getting the new capabilities like that.

42:41 Yeah.

42:41 My daughter was blown away when she got a new pet and then she got two pets and she couldn't decide which pet was her favorite and what she would take with her.

42:49 And it was, yeah, it was, it was great.

42:51 Yeah, yeah, yeah.

42:52 And so then you're, as you move on through the mountain and here's where you know the basis of all the code you need to do really,

42:59 really well in some of these tournament arenas that will run, then the glacier will happen.

43:05 And the glacier is kind of like, all right, let's introduce the vectors.

43:07 And now you're doing vector arithmetic.

43:09 So operating with these various like linear algebra transforms only to you.

43:14 It's not been a linear algebra transform.

43:15 It's like, okay, vector dot rotate.

43:17 And let me think about it.

43:18 This is where it starts to get a little tricky.

43:20 We're introducing kind of the Boolean logic and, you know, counting in other bases and some of these graph search algorithms.

43:28 There's one where you just have to code up your team to play soccer for you.

43:32 And like, that's a lot of geometry and trigonometry there.

43:35 But some kids get that far by themselves.

43:38 Most of them will need to work through that with a teacher.

43:40 Yeah, it's cool.

43:41 And just to give people a sense, like the first engine, there's 43 puzzles, puzzle programs you got to write.

43:47 The forest has 121.

43:49 And the desert has 97 and so on.

43:52 So there's a lot of little problems that the kids can go solve and work on.

43:57 And they're pretty bite-sized.

43:58 So it's quite cool.

43:59 The target goes from three minutes per level in the dungeon up to like, once you get to the glacier, we're like, hey, at least you should take you like half an hour.

44:06 So there's a lot of content in there.

44:09 There's also a lot of hidden content that shows up if you, the system determines you might need a little bit more help.

44:14 Or if you go back and then you unlock secret stuff in the earlier worlds.

44:18 Because everyone is learning at different rates, they're going to need different amounts of practice on the same concepts.

44:23 So if you're doing levels particularly slowly or particularly difficulty, the system might say, okay, here's the next level.

44:29 But it's actually a practice level.

44:30 Some other student might not have gotten that level if they didn't need it.

44:33 Oh, interesting.

44:34 Yeah, that's clever.

44:34 So it can slow it down if you need to.

44:37 We don't have a way to really speed it up.

44:39 But then again, learning this thing is already going pretty fast.

44:42 Yeah, for sure.

44:43 Awesome.

44:44 Well, I think it's a really cool world you've created for these kids and basically beginners in general.

44:48 But it definitely seems like it's going to connect with the kids.

44:51 I know it did with mine.

44:52 So let's talk about some of the internals.

44:55 Yes.

44:56 You talked about the different languages.

44:57 We write Python in the browser in this cool editor with a special autocomplete that we talked about.

45:04 Where does it run?

45:05 So it runs right there in your browser.

45:07 And there's a few pieces of magic to make this happen.

45:10 So the first is we use the Ace text editor.

45:14 And then we've heavily customized that.

45:16 But it's a really, really great, fantastic base layer for doing all sorts of crazy stuff with your code editor.

45:21 So once you get the code, then we are feeding that constantly into a web worker thread that is parsing it, linting it, looking for kind of hints to give to the player.

45:32 Even pre-running it in advance.

45:34 So that once they hit run, the entire world is simulated in the background thread.

45:38 And we just swap out the front-head state with kind of like a video-like playback.

45:41 You can scrub back and forth with what happened.

45:43 So that's all this custom code simulation game engine stuff.

45:48 But what makes it possible are these two libraries.

45:52 So one is Sculpt.

45:53 And that is kind of the Python in the browser implemented JavaScript interpreter parser thing.

46:00 And that is implemented so that you can actually run full Python programs as much as you can.

46:05 We're just using the parser layer from that because we don't want kind of all of these other behaviors to happen that we don't have control over.

46:15 And that ends up giving a crazy error message.

46:17 So, you know, picking pieces of Sculpt out there and then augmenting them with our own systems.

46:24 And some of this you can start to get crossovers.

46:26 So a library for code linting that works for JavaScript.

46:29 And we've turned the AST into a Mozilla JavaScript AST format.

46:34 Then you can start to run some of these tools that were designed to work on JavaScript.

46:37 But you're giving useful information for Python.

46:39 So that's pretty cool.

46:41 That's awesome.

46:41 It is all on top of this thing that we wrote called esper.js.

46:45 And esper.js is designed to be the kind of controllable, pumpable, beginner-friendly interpreter that runs in the browser.

46:52 But takes multiple languages.

46:55 And so there's a Python plugin for it.

46:58 There's a Lua plugin for it.

47:00 As much as you need to do, there's a CoffeeScript plugin for it.

47:03 And then those things, it's two pieces.

47:07 The parser piece.

47:08 So the parser piece, we're relying a lot on Sculpt.

47:10 And we'd previously written our own.

47:11 And it just wasn't very good.

47:13 So we moved over to Sculpt on there.

47:15 And then the runtime library piece where you can take some pieces of that.

47:19 But really for performance, you're implementing a lot of Python functions and modules in this kind of interpreter language

47:27 where you're operating on abstract syntax tree nodes.

47:30 You could just pull in that part of the Python library or write it in Python and then just run it.

47:37 But it gets pretty slow.

47:38 So you'll kind of bring in the hot loops and pull those in natively in Esper itself, in Esper's Python plugin.

47:46 So the more Python behavior that you want, like you want to make integer division work correctly, if it's different from JavaScript, something like that, then you're just putting more and more of it into your runtime or your parser library that plugs into Esper.

47:59 Esper is fully open source.

48:01 So is the Python plugin.

48:03 And if you have a project where you want to mess around with having more control over how the code executes, interrogating each frame, stopping it, starting it again, yielding it and putting another thread in, like all that kind of stuff.

48:14 Definitely check out Esper.js on GitHub.

48:17 If you just want to be able to run Python in the browser, you can just run scope straight up if you don't want to do it.

48:22 Right.

48:22 If you don't need to reinterpret what the instructions mean and like capture them and whatnot, right?

48:27 Like you have a kind of a special use case here, I suspect, and what you're trying to do.

48:32 Well, there's a lot of people that go and want something like this.

48:36 So some of the projects are using Esper.

48:38 I haven't kept a huge track of it, but it's definitely what you would want when you want more control, whether that's for teaching it better or it's for controlling your infinite loops a little better, whether it's for just security of your program.

48:53 Because, you know, you're running this thing in your user's browser.

48:56 You know, maybe you're pulling in code that someone else wrote into that.

48:59 You got to make sure that it can't break out.

49:01 And so just having that knowledge that it's secure and it can't touch anything and you can redefine your global variables and lock them down.

49:08 Make your own copies of them, whatever you want to do.

49:10 It's pretty good.

49:12 Yeah, that's pretty neat.

49:13 In Python or in other languages.

49:15 Yeah.

49:15 Did you consider something like Docker, like a server side solution as well?

49:20 Or was it always we've got to do this on the front end?

49:22 You know, after seeing Brett Victor's talk on learnable programming, which is fantastic.

49:26 So if you haven't seen it, you know, stop listening, go check it out.

49:29 I mean, no, this is probably kind of interesting, but that is so interesting.

49:33 So the idea there is this kind of run it on the server and send the result back format.

49:38 Is kind of old school algorithms competition kind of thing going on?

49:42 Yeah.

49:42 Yeah.

49:42 Super secure.

49:43 Take some server resources, which you can probably figure out how to get working.

49:46 But it's limited in the bandwidth of what it can tell you back.

49:50 So if you think of, hey, here's an algorithms program, a problem, and I'm going to write my algorithm and run on the server and see if it gets the right answer.

49:58 Really, you're sending back the answer.

50:00 Yeah.

50:00 But what we want for a rich, immersive gameplay world is we don't want to just know the answer.

50:05 We want to see everything about how this code is executing because it can touch every part of the world.

50:10 So if you wanted to do that, you have to run the whole thing on the server.

50:16 And now you're basically spinning up your own kind of network to multiplayer game that your servers have to run every instance of and send the entire state of the execution back.

50:27 And like normally in computer graphics, you are just sending like positions of the various entities in the game, maybe their velocities, rotations, and a few status things so that you can render them.

50:38 And you kind of have the same thing going on here.

50:41 But we don't know in advance what you're going to need to show because instead of the, you know, C++ optimized game engine having like, okay, everything is going to be rendered, like efficiently optimized for rendering these 12 properties on this number of entities and then these types of backgrounds or whatever.

50:56 Anything can happen.

50:57 So you can't optimize that much, which means the amount of data that you have to send back in order to render it is fairly high.

51:03 So if you sent that to the server, you'd be downloading like 15 or 20 megabytes every time you ran the code.

51:08 I mean, maybe we would, if we optimize that, I'm sure we could get it down to something workable, but it's kind of going to be a little, a lot further towards that.

51:17 Just tell me the answer.

51:18 Then like I'm playing this here in my browser.

51:20 So that's, that's why we didn't do it there.

51:23 Yeah.

51:23 And also you'd have to do some interception to like kind of rewrite what execution means to do the work that you're doing.

51:30 Yeah.

51:31 Right.

51:31 So you'd have to do it on the server side anyway.

51:33 It sounds like you can't just drop it in and hit it with C.

51:36 Well, the advantage of doing it on the server side is that you can use actual JavaScript is the only language that you're going to be able to run in the browser there.

51:43 And JavaScript, I love it.

51:45 It's a great language.

51:45 It's basically scheme in Java's clothes.

51:49 And so you can do all this really high level crazy stuff, but you, you can shoot your foot off and there's not that many packages that want to do what we want to do there.

51:58 So, you know, if you had to run this code on the server, you could do it in C, you could do it in Python, you could do it in whatever.

52:04 And that would be pretty advantageous.

52:06 And there's a lot of these most, we, at some point we're looking at teaching like dozens of program languages way.

52:11 And you look and say, okay, who's implemented an interpreter that I can use or a parser that I can use.

52:15 And it's all implemented either in the language itself or something like C or something like that.

52:19 You can't use any of that in the browser.

52:21 So it could have saved some work, but, you know, we really wanted it.

52:25 Like, write some code, click the button, immediately see what happens and enrich detail and be able to like scroll back and forth.

52:33 We want to send the entire state of the world so you don't just see it once.

52:36 We want to have it render as fast as we can so you know if there's any bugs or any errors.

52:41 And then we want you to be able to play back, go back and forth, time travel, debug, any of that stuff.

52:46 So we kind of over-engineered it in the beginning after seeing that talk and happy with how that turned out.

52:53 But, yeah, it's a lot of work.

52:54 Yeah, well, it definitely helps on the scaling side of things.

52:57 Oh, yeah.

52:57 The other thing that you can do, because the user's browser knows how to not just run the game but their code,

53:02 when you go to do the multiplayer pieces, our server doesn't do anything either except for say like,

53:07 hey, peer-to-peer distributed simulation net, you simulate some games here,

53:11 and then they report the answers back and we just keep a leaderboard.

53:14 But, like, we'll be distributing all these other players' games to everybody who's, like,

53:18 trying to play one of these multiplayer levels, and then you get this automatic, like,

53:21 simulated ladder thing for no compute.

53:23 It's pretty great.

53:23 Yeah.

53:24 Yeah, that's pretty awesome.

53:25 Cool.

53:26 Well, it's definitely neat to see you guys taking some of these Python in the browser initiatives

53:32 that there's not a whole lot of other people doing, like, real work with, right?

53:38 Like, building real tools.

53:39 You know, the guys over at Anvil, they build a pretty interesting system based on Sculpt as well.

53:45 A lot of cool designers and front-end tools, basically.

53:47 Have you seen Anvil?

53:49 I'll have to check it out.

53:50 Yeah, so Anvil is a way for building, like, simple hosted web apps.

53:54 Go there.

53:55 And they've got, like, a component gallery of buttons and text boxes.

54:00 You drag them over.

54:01 And then all of those have events.

54:03 You double-click it and it switches over to see the code.

54:05 But that's all Python code that runs in the browser on Sculpt.

54:08 Oh, that's awesome.

54:10 Yeah, so it's pretty awesome.

54:11 There's also Brython out there, too, for another take on it.

54:15 Yep.

54:15 Did you look at Brython and consider it alongside Sculpt?

54:18 It wasn't as far as along when we kind of put our stuff together.

54:21 But, you know, I think either of them could potentially have worked.

54:25 We just needed a parser layer from it.

54:27 I can't remember if Brython would use the Mozilla AST format or something else.

54:32 Right.

54:32 I think this is great.

54:34 Well done on building it that way.

54:35 So let's just talk briefly about the business side of things.

54:39 I think it's always interesting to see people building businesses on Python and bringing

54:43 these tools together and whatnot.

54:45 Yeah.

54:45 So I guess, first of all, we haven't talked about this yet for people who don't know.

54:50 Like, is there something I pay for?

54:52 It's Code Combat free.

54:54 What's the story?

54:54 Yeah.

54:55 So we are an open source project.

54:58 And, you know, it goes back to my roots with my dad having that Mr. House home automation

55:02 project, which it just seemed like back in the day, that was like the thing you did was

55:05 cool.

55:05 And when we started building this business, we weren't thinking about open source, but we

55:08 knew we wanted to do a for-profit business because that's how you can get the resources

55:11 to really make great software.

55:12 And, you know, there's obviously going to be a big market for people learning how to code.

55:16 So we built this thing, built this thing.

55:18 It was free for a long time.

55:19 I said, hey, we're going to start charging for this thing.

55:20 But that was kind of still in the mind, like there's going to be a lot of people who can't

55:24 afford however much you're going to charge that still should be able to learn to code.

55:27 And especially if your game is multiplayer, you kind of want those players anyway.

55:30 So not just to provide network effects for playing the game, but also for sharing the game.

55:35 So the initial model we did is a $10 a month subscription, but freemium.

55:40 So you only have to pay for that if you want the extra levels, extra heroes, extra gems,

55:45 some of this game content stuff.

55:48 But it's not like you get the first 20 levels for free and then you have to pay.

55:51 It's more like you get the core progression of levels from the beginning all the way to

55:55 your crazy graph algorithms in the end.

55:57 And then it's extra practice levels that are kind of the branches of the tree that you would

56:01 pay for.

56:02 So if you want more help with that, you just want more content, you want a cool hero as

56:06 opposed to the basic hero, then you can subscribe.

56:08 And so most players, you got a couple hundred thousand monthly active players.

56:13 Most of those are just playing for free.

56:15 We kind of made a mistake because when we started to take off as a business, we had all

56:19 these players.

56:20 We said, OK, well, the main market for this is going to be in the schools.

56:23 And in the schools, you have this huge need for teachers to be able to deploy some computer

56:28 science curriculum that kids will actually do, even if the teacher is not there over their

56:32 shoulder all the time.

56:33 And especially if the teacher is not a pro coder, which, you know, if you're a pro coder

56:37 and you're working in teaching, I salute you because that's a really hard job.

56:40 You probably know where you can make elsewhere and it's more than twice what you can make

56:43 as a teacher.

56:44 So not a lot of super experienced coders in teaching and all of these teachers getting

56:49 deputized to teach computer science.

56:51 The math teacher has to teach it.

56:53 The English teacher, the choir teacher has to teach it like help.

56:57 Right.

56:57 So they reached out.

56:58 We said, hey, you know, we can help you run this with your students.

57:01 Let me see what we do, built the teacher dashboard and our main product is now that classroom

57:04 version.

57:04 And so when we made a bunch more content for that, we actually forgot to set it as paid

57:10 on our on our home version.

57:12 And so there's a couple of hundred free levels like you could just do so much there.

57:16 And it's not the main way we make money.

57:19 So I'm cool with that.

57:20 We're not trying to optimize that to within an inch of its life in terms of conversion funnels

57:24 or anything like that.

57:25 So, yeah, it's great.

57:26 We make a little bit of money from that business, but it also means you can just go play for free.

57:30 You don't have to sign up, try it out.

57:31 And if you wanted that extra help or extra content, you can get that.

57:36 Now, the new thing is if you want extra help, you can pay for private lessons from one of

57:42 our online coding teachers.

57:43 You know, they'll work an hour or two hours a week with your kid or you can do group classes

57:47 with up to four other students, up to four students total.

57:49 And so those are some ways it works.

57:52 We've got some different pricing models in China where we run our business too.

57:56 But as an open source project and with this kind of community in mind, this helped us

58:01 so much.

58:01 Like, it's great to be able to give back and make a bunch available for free.

58:04 Yeah.

58:05 We wouldn't even have Python if it weren't for open source.

58:08 When we launched, we only had JavaScript.

58:10 And one of the first major contributions, we ran this like programming language edition

58:15 like contest.

58:16 I think we gave away like a MacBook and an iPad or something.

58:18 And for that, we got Python and Lua and like all these parts.

58:21 Even someone did Clojure.

58:23 And we're like, dang, that was really efficient.

58:25 And we hired two of them.

58:26 And like going open source was just super interesting.

58:30 But yeah, that we have this ethos where if you need to learn to code, you can use us.

58:34 I'm not going to charge you.

58:35 Yeah.

58:36 So there's like a free path through these worlds.

58:38 If you want, you can take it, but you can pay for more.

58:41 Yeah.

58:41 Pay for the side branches of the learning path, basically the learning tree.

58:44 Yeah.

58:45 Cool.

58:45 Well, that seems like a pretty solid model to me as well.

58:49 So maybe let's close this out with two quick questions.

58:52 One, what's coming in the future?

58:54 Do you guys have any like cool things that you're adding or just keep going, adding content?

58:59 Well, we have in the classroom, the new thing is Ozaria.

59:03 So as we put these teacher features on for based on the home product, you know, we learned a lot.

59:09 We ran over 80,000 educators through this thing.

59:11 And over the last two years, we've been building out an all new series of content.

59:16 Now we're putting it with new brand.

59:18 It's got new learning modes, got all this story.

59:21 And that is going to be the primary classroom product starting in next month, basically.

59:26 So that's at Ozaria.com.

59:28 And you can't play that on your own really, because that's meant for the teacher experience.

59:33 But, you know, if there's a school involved, then they should, they'll be using that and

59:37 they'll have, it's really cool.

59:39 So that's the new thing on the classroom side.

59:42 The new thing on the home side is of course, we have added this online teaching and that's

59:46 growing pretty well.

59:47 So just kind of expanding what we're doing with that in China, getting it translated into

59:52 even more languages, adding C++ and Java and kind of capitalizing on the potential of what

59:59 we're doing.

59:59 Like you say, there's, there's all these things you can do to optimize every error message in

01:00:03 every level.

01:00:04 And of course, we haven't done that with everything.

01:00:06 So there's just so much more of the core of polish of what we want to do.

01:00:09 Right, right.

01:00:10 Each little challenge can have like its own special messages and sort of help support that.

01:00:17 I'm sure that can always be polished.

01:00:18 Oh, yeah.

01:00:19 It's unbounded what the kids are going to mess up.

01:00:21 Yeah.

01:00:21 Eventually we need to hook up a machine learning system here that's really doing, I mean, something

01:00:25 simple, like a multi-armed bandit system or something like that, where we're measuring

01:00:29 the effectiveness of every possible intervention point, put it in there and optimizing all of

01:00:33 that based on the data, as opposed to kind of digging into the hotspots by hand and game

01:00:37 designers going into it.

01:00:38 But that's what's up for us, just getting better and better and better at teaching coding and

01:00:42 into more context, more people, more languages.

01:00:46 Yeah.

01:00:46 We're up to.

01:00:46 Yeah.

01:00:47 Cool, cool.

01:00:48 And last question, COVID completely changed education.

01:00:53 Yeah.

01:00:54 It's probably going to change it in the fall for at least in the United States and some

01:00:57 other places.

01:00:58 This has got to be a boon for you guys to say, look, we have this opportunity to reach

01:01:04 out to many more people who need education and maybe, like you said, more remote friendly

01:01:09 education.

01:01:09 Oh, yeah.

01:01:10 It was originally, you know, we have our team in China and China got shut down.

01:01:14 And a lot of the stuff we were selling in China was offline training centers after school.

01:01:17 So we took a hit.

01:01:19 We saw it coming.

01:01:20 And we even hired an epidemiologist in late February to say, hey, what's going to happen?

01:01:24 So she saw everything coming.

01:01:25 And we're like, hey, sound the alarm, guys.

01:01:27 This is bad, but we can help.

01:01:29 And so just as awful as it's been in most dimensions for our business, like it's relatively good.

01:01:37 The intersection of online learning and online gaming for us, it's just this big opportunity

01:01:42 to help out in these trying times.

01:01:43 So like my kids, my five-year-old will be going to kindergarten.

01:01:46 Oh, that's off.

01:01:47 You have kids that like, you know, maybe you're not going to be in as much school as you'd hope,

01:01:51 but you want something for them to do at home.

01:01:53 Have them check out Code Combat.

01:01:55 If you really want them to have some structure, get one of our teachers for that or share it

01:02:00 with your school and we can help out.

01:02:01 So that is, you know, as long as this thing looks like it's going to be with us, we'll be

01:02:07 adding more and more of this stuff that makes it even easier to do it from a distance.

01:02:10 Yeah.

01:02:10 Well, fingers crossed that it doesn't stay with us for too long, but what you guys have

01:02:16 built will definitely, you know, help fill the void, I think.

01:02:18 Yeah, thank you.

01:02:19 Yeah, sure.

01:02:20 All right.

01:02:21 Well, before we get out of here, let me ask you one of the two questions I'll ask at the

01:02:27 end.

01:02:27 So if you're going to write some code and, you know, we were talking right before we hit

01:02:32 record that working on this for Python, this is really mostly a JavaScript project, much

01:02:38 like working on the visualization tools for say like Jupyter Notebooks, right?

01:02:42 Even though it's for Python in some sense, like the creating of it is in a JavaScript.

01:02:47 So what tools do you guys use to write your code to work on this?

01:02:51 Yeah.

01:02:52 So our engineering team is all over the place on editors.

01:02:55 When you have your kind of JetBrains stuff, you have your Visual Studio, your VS Code, you

01:03:01 have some LimeTags.

01:03:03 I started this with Emacs and I'm still on Emacs.

01:03:06 I'll be on Emacs forever because I'm like arcane techno amoeba of Emacs that nobody can

01:03:10 understand.

01:03:11 So you're sticking to your scheme roots, your Lisp roots?

01:03:14 Oh, yeah.

01:03:15 I'm not that great in Emacs Lisp Packer, but I got a few macros here and there.

01:03:19 Probably for my cold dead hands.

01:03:21 Yeah, right on.

01:03:22 Awesome.

01:03:22 All right.

01:03:23 Now, final call to action.

01:03:24 People are excited about this.

01:03:27 They want to try it.

01:03:27 Maybe want to try it with their kids.

01:03:28 Yeah.

01:03:29 What do you say?

01:03:29 CodeCombat.com /play.

01:03:31 No sign up.

01:03:33 Just pop it in front of them.

01:03:34 See how they do.

01:03:35 And if there's a teacher in your life or a school, that would be the Ozaria product.

01:03:40 Ozaria.com.

01:03:41 Send it to them and see if we can get their school hooked up.

01:03:44 There's a bunch of free stuff there too.

01:03:45 And a lot of people are looking for this.

01:03:48 So, yeah.

01:03:49 Awesome.

01:03:49 Thanks for the time.

01:03:49 This has been really fun.

01:03:50 Yeah.

01:03:51 It's been great to talk to you about it.

01:03:51 And congrats on the project.

01:03:52 I think it's really opened up like proper coding for a whole nother level.

01:03:58 And I'm really happy to see it.

01:03:59 Yeah.

01:04:00 Yeah.

01:04:00 Yeah.

01:04:00 All right.

01:04:01 Take it easy.

01:04:01 All right.

01:04:02 Bye.

01:04:02 Bye.

01:04:02 This has been another episode of Talk Python to Me.

01:04:06 Our guest on this episode was Nick Winter.

01:04:08 And it's been brought to you by Linode and us over at Talk Python Training.

01:04:11 Start your next Python project on Linode's state-of-the-art cloud service.

01:04:16 Just visit talkpython.fm/Linode.

01:04:19 L-I-N-O-D-E.

01:04:20 You'll automatically get a $20 credit when you create a new account.

01:04:24 Want to level up your Python?

01:04:26 If you're just getting started, try my Python Jumpstart by Building 10 Apps course.

01:04:31 Or if you're looking for something more advanced, check out our new Async course that digs into

01:04:36 all the different types of Async programming you can do in Python.

01:04:39 And of course, if you're interested in more than one of these, be sure to check out our

01:04:43 Everything Bundle.

01:04:43 It's like a subscription that never expires.

01:04:45 Be sure to subscribe to the show.

01:04:47 Open your favorite podcatcher and search for Python.

01:04:50 We should be right at the top.

01:04:51 You can also find the iTunes feed at /itunes, the Google Play feed at /play,

01:04:56 and the direct RSS feed at /rss on talkpython.fm.

01:05:00 This is your host, Michael Kennedy.

01:05:02 Thanks so much for listening.

01:05:04 I really appreciate it.

01:05:05 Now get out there and write some Python code.

01:05:06 I really appreciate it.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon