Latest / Talk Python To Me / #278: Teach kids Python with real programming and fun games at Code Combat
Transcript
- 0:00If there's one message I've been pushing across all of the Talk Python episodes, it's that programming is a superpower.
- 0:06Rather 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.
- 0:15In that case, we should be teaching kids fluency in programming at a younger age.
- 0:20And yet, almost every platform or example meant to do so pulls its punches.
- 0:24We teach kids programming concepts, but not code itself.
- 0:28We'll use these blocks because text-based programming, that's a bridge too far.
- 0:32But it's not, and that's why I'm excited about CodeCombat.
- 0:36It's an online coding platform that uses real Python syntax to guide your hero visually through a dungeon full of challenges.
- 0:43Yet the editor in customized error messages means this is approachable for kids before they can even reliably type.
- 0:49On this episode, you'll meet Nick Winter, one of the co-founders of CodeCombat.
- 0:53There's a lot of philosophy behind the tool and technology to make it kid-friendly and real Python at the same time.
- 0:59Oh, and it's running Python in the browser.
- 1:01This is Talk Python To Me, episode 278, recorded July 19th, 2020.
- 1:20Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
- 1:27This is your host, Michael Kennedy.
- 1:28Follow me on Twitter where I'm @mkennedy.
- 1:31Keep up with the show and listen to past episodes at talkpython.fm.
- 1:34And follow the show on Twitter via at Talk Python.
- 1:37This episode is brought to you by Linode and us.
- 1:41Have you tried to learn Python but got stuck or lost focus?
- 1:44We know how it feels to try and jam fact after fact, loop construct after turn hair expression, into your head.
- 1:52At best, it's boring.
- 1:53At worst, it can turn you off programming altogether.
- 1:56That's why we built our course, Python Jumpstart by Building 10 Apps.
- 2:00This course guides you through carefully planned applications.
- 2:03It starts simple but progresses to quite real apps.
- 2:06Best of all, you won't be learning dry facts.
- 2:09You'll be learning like the pros do by building real applications and learning in context.
- 2:14If you want to start building with Python, just visit talkpython.fm/course to get started.
- 2:20Nick, welcome to Talk Python To Me.
- 2:22Oh, thanks for having me.
- 2:23Yeah, it's great to have you here.
- 2:25Your platform, Code Combat, is something I've been a fan of for a while, ever since I came across it.
- 2:29So I'm looking forward to talking to you about it.
- 2:31Before we get into that, though, let's start with your story.
- 2:33How did you get into programming?
- 2:34My dad was an engineer at IBM doing custom chip designs for a long time.
- 2:39And so he had the first big open source home automation project written in Perl.
- 2:45And he would even have neighborhood kids around mentoring them in coding and all this sort of stuff.
- 2:50And I never tried it.
- 2:51And so that's not how I got into coding.
- 2:53You had this chance, but you didn't take advantage of it.
- 2:56I don't even know.
- 2:56Maybe I just thought that was like a dad thing.
- 2:58I don't know.
- 2:59But like, I never tried it.
- 3:00I was doing all this other stuff.
- 3:02My mom was more on the artistic side, writer.
- 3:05And I was trying all the writing really terrible poetry, all that kind of stuff.
- 3:08And so when I got to college, I had no idea what I was going to do.
- 3:11And I tried everything.
- 3:13And chemistry class, maybe not so much fun.
- 3:16Poetry class, pretty fun.
- 3:18Tried a coding class by luck.
- 3:20And I was like, damn, this is so boring.
- 3:24And but that was like the first, you know, part of the semester, right?
- 3:28Because we're coding in Java.
- 3:29And, you know, at this year, I've had like, I've had like billions of years of advanced mathematics
- 3:35class.
- 3:35And it was like, all right, we are going to do simple arithmetic in Java.
- 3:38And it's going to be really hard.
- 3:40And I was like, why would I need to make a computer do something that I already know how
- 3:45to do since like 20 years ago?
- 3:46But like, and we got to the end of that first semester, though.
- 3:50And although it was kind of boring, it was really easy for me, not so for necessarily all
- 3:54my classmates, just the way that it was taught, typical failure rates in computer science programs.
- 3:58And we get to the end.
- 4:00And then there's this project.
- 4:01And the project is a rabbits and foxes simulation.
- 4:04And I was like, okay, got coding it up.
- 4:07It's kind of cool.
- 4:08I can say these colored squares on the screen.
- 4:10There's the red one.
- 4:11There's the, wait a minute.
- 4:12Could I make another one?
- 4:14And of course, this was a sample project, which almost everything done for you so that
- 4:17you get anything done.
- 4:18And I figured out, I was so proud.
- 4:19I put in zombies.
- 4:21And so now there's the black squares on the screen.
- 4:23I'm like, wait, they're infecting them.
- 4:24And there's undead rabbits and zombie kings.
- 4:26And I was like, wait a minute.
- 4:28You could just make stuff with code.
- 4:31You could just do whatever you want.
- 4:32It's creative.
- 4:33Wait, oh, this is cool.
- 4:34I'm into that.
- 4:34So then I got into it.
- 4:36So this college class, finally, I got lucky with like the last project of that first semester.
- 4:41And then I was hooked.
- 4:42And so we had that whole computer science undergraduate thing in Java.
- 4:46And I was like, man, Java is kind of terrible.
- 4:48We got into Scheme.
- 4:49We're doing a lot of that.
- 4:50I was like, this is great.
- 4:51And then we got into Python because I actually had to start writing some real software.
- 4:55And that was where you kind of put together a lot of the high level elegance and power
- 5:01that you would have from something like a Scheme.
- 5:03But you don't have to be a genius hacker, which at that point, I definitely wasn't to like
- 5:08actually write something to put some UI on the screen and get people to use it.
- 5:11So that's awesome.
- 5:12And you didn't have to have like 50 closing parentheses.
- 5:14There, I remember doing a lot of closing parentheses and it being real, real messy.
- 5:22Scheme is such a crazy language.
- 5:25Scheme is less.
- 5:26I took that as well in college as like my CS credit or whatever.
- 5:29And it kind of drove me crazy.
- 5:31But yeah, I feel like hearing your story that it's pretty common that the way programming is
- 5:38taught in universities, especially at the low levels, I think it's like, we're just going
- 5:42to teach you the facts and you have to wait four months before you can actually do anything.
- 5:48And you're just going to have to have this delayed gratification or you have to be motivated
- 5:54beyond the near term, right?
- 5:56Like I'm going to spend a whole week doing loops.
- 5:58I don't really have anything to loop over.
- 6:00I don't care about looping, but we're doing loops.
- 6:03And then the next time we're doing functions and we're doing types and then we're doing
- 6:05interfaces.
- 6:06And like it's taught is just like a series of facts.
- 6:10I feel like that strips out a lot of people because they don't get to have that experience
- 6:14you had at the end of the class until the very end.
- 6:17And by that time, a lot of people are like, yeah, no.
- 6:19Well, yeah.
- 6:20And it's even worse than not having anything to loop over because they do give you something
- 6:24to loop over.
- 6:25And it's math.
- 6:26It's like we're doing arithmetic here.
- 6:27Or like it's the terminal stuff.
- 6:30Like let's print some strings, but like the length of the string.
- 6:33And like that doesn't get you going.
- 6:36That's not what's getting most of these kids out of bed.
- 6:38It's not what's getting like really matters to folks.
- 6:40And so it's sending the message, hey, coding, computer science.
- 6:43This is like math, but geekier.
- 6:45So, you know, if you're not a math person, stay away.
- 6:48That is wrong to me.
- 6:49Yeah, I agree.
- 6:50Because there's a lot of creative aspects.
- 6:52There's a lot of amazing things that you can build.
- 6:55I think it's a little bit less so now with all the mobile apps and like applications
- 7:00have really infused society or come across like deeply.
- 7:05They're all over society now and they're somewhat beautiful.
- 7:08A lot of times 10 years ago, that wasn't even the case, right?
- 7:12Well, but the thing that you're starting off with is rarely going to be a beautiful mobile
- 7:17app that you care about, especially if you're in a formal learning environment.
- 7:20Right.
- 7:21Maybe it's worse.
- 7:21Maybe it's you look at Instagram, that mobile app.
- 7:25You're like, I want that.
- 7:26They're like, no.
- 7:27What you're going to do is you're going to implement the quick sort algorithm in scheme
- 7:31by hand over these numbers.
- 7:33Why would I do this?
- 7:35I would never do this.
- 7:36For some of us, it kind of gets you going.
- 7:37I liked that part of it, but, you know, I didn't know that I would like that.
- 7:41And I never thought like, hey, let me give this a try.
- 7:44Yeah, I think ultimately people who are really into it do get to where they like that.
- 7:47But I feel like you've got to get to the, hey, this stuff is awesome sort of place.
- 7:53And then you can start to appreciate and dig into those things.
- 7:56So if we think then what happened next.
- 7:59So I was in college and I was learning all this coding stuff and I was also learning math and
- 8:04I was learning Chinese and I was reading Paul Graham essays and Paul Graham essays have a
- 8:10lot of great stuff in there about your high level languages.
- 8:12But they also have this entrepreneurship stuff, which I had never heard of.
- 8:15I have been coming for like the scheme talk and the list talk.
- 8:19And he's like, he's got one of these where he says, oh, you know, you shouldn't have a job.
- 8:23You weren't meant to have a boss.
- 8:24You should just start your own startup and do your own thing.
- 8:27And smart young people should just start their own startups.
- 8:29And I was like, yeah, man, that sounds great.
- 8:32I don't want a job.
- 8:32I'll just start my own startup.
- 8:34So I went to my roommate and I was like, hey, hey, hey, we've got to start our own startups.
- 8:37He program says, who is the what?
- 8:39No, I'm doing my econometrics homework.
- 8:41So I get my Wall Street job.
- 8:43And so stop bothering me.
- 8:44And I'm like, no, no, no.
- 8:46I pestered him until he's finally fine.
- 8:48If you can think of something that's a good idea that like as a business, then we can maybe
- 8:53give it a shot.
- 8:54Until then, Wall Street, econometrics, go away.
- 8:57And so I was pondering, pondering, pondering it and had all sorts of really stupid ideas.
- 9:03And I went to China as I was learning Chinese for a few weeks.
- 9:09And I had this really crazy experience with reverse culture shock.
- 9:14And I was really sick.
- 9:14And it was like four in the morning.
- 9:15And I saw this other guy who was named basically the same as me.
- 9:20And he's the only other like Chinese and computer science student in my same year.
- 9:23And like randomly met him in Beijing.
- 9:25And I had no idea he was going to be there.
- 9:27Like Beijing is a city of like 20 million.
- 9:28Yeah.
- 9:29And so 4 a.m.
- 9:29We're getting up to go to the Chinese McDonald's on the way out to fly to the airport.
- 9:33I was like, what is going on?
- 9:34I see him.
- 9:35He's writing Chinese characters.
- 9:38On his Nintendo DS practicing it at like the stroke level.
- 9:42So he's got this handwriting recognition.
- 9:43And I'm like, man, that's so cool.
- 9:45I need to learn Chinese characters like that.
- 9:47And he's like, what?
- 9:47No, I'm playing trauma surgery.
- 9:49I'm like a Japanese surgeon in combat, like saving patients.
- 9:52I'm like, oh, I thought you were practicing Chinese.
- 9:54Oh, wait a minute.
- 9:55I do want to practice Chinese like that.
- 9:57So I, and that was the first kind of Python program, right?
- 10:01We got into it there because I was like, hey, I need to write some software that makes it
- 10:06so that you can write characters in Chinese at the stroke level and like practice that
- 10:11way.
- 10:12Because it takes a lot of learning Chinese characters to really learn Chinese.
- 10:15And that's like the hard part.
- 10:16So it's all that part.
- 10:17Like, hey, that's got to be a business there.
- 10:18People pay for that, right?
- 10:19I pay for that.
- 10:21Well, I mean, I don't have any money, but I would, I would use it.
- 10:23And so you can see we're thinking much more from the technology aspect at that time than
- 10:27the business aspect.
- 10:28But we say, hey, there's a problem.
- 10:29We can solve it.
- 10:30And, you know, we reach for the real practical language here.
- 10:34We're not pulling Lisp off the shelf where we're going into Python.
- 10:37And I hardly knew it.
- 10:38So the first Python program that I wrote basically was this character editor that would like start
- 10:44to form the data layer for this Chinese language learning app.
- 10:46And with that, I was able to convince my roommates to kind of jump and not go and work in Wall
- 10:51Street, which is great because that was 2008.
- 10:53And my roommate was actually not a terrible time to go to Wall Street.
- 10:57Then lost that job.
- 10:58Yeah.
- 10:58He would have had a good two month run there maybe.
- 11:01But yeah, yeah, yeah.
- 11:03Yeah.
- 11:03So we, then we're just some guys hacking in our house and working on this thing, see if
- 11:08we can get it going.
- 11:09And, you know, even though we were really kind of terrible coders at that time, but, you
- 11:15know, Python was flexible enough that we didn't get bogged down in architecture.
- 11:19And we wrote that we had, you know, at the time, we had, you know,
- 11:21at that time there was no iPhones.
- 11:22It was like welcome tablets and, you know, handwriting recognition, learn some Chinese,
- 11:27hack on some code.
- 11:28And, you know, that took off.
- 11:30So we made the, and, you know, the backend we did in Google app engine with Python and
- 11:36Django.
- 11:37And we kind of got it going.
- 11:38We got profitable.
- 11:40We made the number one app for foreigners to learn to write Chinese characters and off
- 11:44to the races.
- 11:45So the first Python program I wrote ended up, you know, pretty good, man.
- 11:48That's pretty awesome.
- 11:49That sounds like a useful app.
- 11:51And I think it captures a little bit of what you've done with code combat as well.
- 11:57in the sense of, oh, I don't want to just sit down and learn this rote memory practice type
- 12:03of thing, but I want to learn it in the context of play.
- 12:05If we think of kind of the transition from Skritter, which is the Chinese character running out to
- 12:11code combat, it was the same founding team.
- 12:14And we had, we'd been running it for five years and we said, Hey, well, you know, we've made enough
- 12:19money to not need to work again.
- 12:21Let's retire.
- 12:22And I made it about nine days.
- 12:24I was like, guys, I'm so depressed.
- 12:26We got to do another one.
- 12:27And they're like, okay, what should we do?
- 12:28We had some really stupid ideas on there too.
- 12:30We're like invisibility cloaks that actually work.
- 12:32Let's do it.
- 12:33And they were like, no, no, what do we know guys?
- 12:35We know how to make ed tech teach hard things.
- 12:37Okay.
- 12:38Cause we take this language learning approach to learning Chinese characters.
- 12:42Obvious.
- 12:43It's a language.
- 12:43You should do that.
- 12:44And then we thought, okay, coding.
- 12:46That's something we cared a lot about.
- 12:47Me and my other co-founder, you know, he had also learned in college.
- 12:50We both wished we'd learned earlier.
- 12:52And we're like, okay, well, yeah, those CS classes could have worked a lot better if
- 12:58we kind of built the fluency first, as opposed to kind of the intensive learning.
- 13:03We do the extensive learning where it's easy, just right at that zone of proximal development.
- 13:07You're going to go for hours in flow state as opposed to go for half an hour and, you know,
- 13:12rage kick your segfault computer out of the window or something.
- 13:16And so we're like, all right, well, if you can build the convert, if you can make it more
- 13:21like language learning than like math, where you're having a conversation with the computer,
- 13:24then I mean, language learning, if you have a kid and you have a native speaker and they
- 13:30have a one-on-one conversation and the native speaker can bring it down to the kid's level,
- 13:35like, obviously that kid is going to learn that language.
- 13:38It's not a question of if they're like a language person, like people think of themselves as math
- 13:42people or not math people.
- 13:43Like that would be absurd to think, oh, I'm not a Spanish person.
- 13:46I can't, I can't learn Spanish.
- 13:47I mean, that would mean something else, right?
- 13:49I'm not from Spain.
- 13:49But so we were thinking, okay, if you use these methodologies where you have just like native
- 13:54speaker conversation with the learner and you can bring it down to the learner's level,
- 13:58then that should work, right?
- 14:00If computer science, the hard part of that is actually the coding part, as opposed to
- 14:05the science part where you, all these other things are pretty easy to explain in lectures
- 14:09or there's not all that much science in what most people do with it either.
- 14:12It's kind of the craftsmanship and being able to express your thoughts to the computer.
- 14:15Well, if we have, we need a native speaker, well, who's the native speaker of coding?
- 14:20Well, it's the computer already.
- 14:22Like you don't need a human for that, but the computer only speaks computer language.
- 14:28So you, you, you get the beginner coming in there and they're saying, you know, they're
- 14:32trying to print out their hello world, but you know, they're like putting some extra spaces
- 14:36in there, whatever they do.
- 14:38Of course, they're going to make some mistakes.
- 14:39Normally that syntax error, unexpected token.
- 14:42And they're like, yeah, what does this mean?
- 14:44And they need someone to explain.
- 14:45Right.
- 14:45I like, I forgot the comma, but it knows what I mean, right?
- 14:48Like, no, it doesn't know what you mean.
- 14:50It has zero forgiveness.
- 14:51Yeah.
- 14:52No forgiveness.
- 14:53And it's because all of the code engines out there.
- 14:55And I mean, I love the Python interpreter, but like it, like everything else was designed
- 14:59for professional software engineers to use by professional software engineers who have
- 15:04this curse of knowledge.
- 15:05And they're like, oh yeah, this makes sense without ever thinking like, what if it didn't
- 15:10make sense?
- 15:10What should you say?
- 15:11And so not at all suitable for beginners, but that's every text-based code language engine
- 15:16out there that I know of, right?
- 15:18Error messages are quite arcane.
- 15:20And that's a huge problem in learning to code because you need someone to interpret.
- 15:24So if you did something as simple as seemingly simple as make all the error messages make
- 15:29sense, then that'd be a huge step towards having that conversation flow.
- 15:35So for example, in CodeEngine, in CodeCombat's CodeEngine, we have written a lot of codes
- 15:39so that, you know, no matter where in the stack the error is, whether this is a syntax error,
- 15:45a linting error, it's a runtime error, it's maybe not even an error, but it's just a logic
- 15:49error and could be valid, but we happen to know it isn't for this level that you're trying
- 15:53to do.
- 15:53Then we'll say beginner-friendly error message.
- 15:56So it will say, don't put a space, or that should be a capital R, not a lowercase R.
- 16:01Did you spell, you said dwan instead of down, you should probably fix that.
- 16:06Yeah.
- 16:07And everything else is like syntax error and expected token or, you know, undefined method.
- 16:11Like, those are not words.
- 16:12So when we came at it with this language learning perspective, then you have the native speaker,
- 16:19which is the computer, get it to speak the beginner's language.
- 16:23And then, you know, people are just off to the races.
- 16:25Like, every mistake they make is a teaching opportunity.
- 16:27They solve it in 10 seconds that it takes them to read the error message and edit the code.
- 16:31And that is so much faster.
- 16:33It's that conversation.
- 16:34So if our insight for teaching coding was you have that conversational mode as opposed to
- 16:41that intensive kind of abstract, geeky instruction kind of mode, and then you have to make it mean
- 16:48something like you were saying to the learner.
- 16:51And what do you, you know, if we're targeting kids, especially here, what do kids care about?
- 16:55They want to make and play games.
- 16:57You want to make websites and apps.
- 16:59And those are the things that matter.
- 17:00And so if you can get them learning to code and making that stuff quickly, then that has
- 17:07meaning not just for your geeky boy who sees themselves as, you know, a coder someday, which
- 17:12is a huge minority of the population.
- 17:14It's more like basically everyone because 97% of kids play video games.
- 17:17So like, what was I doing instead of learning all this coding stuff from my dad?
- 17:22Well, I was just playing video games the whole time.
- 17:24And so if I had had a video game that taught me to code, maybe we could, we could get out
- 17:29on that a little earlier.
- 17:30And same thing for co-founders, right?
- 17:32So we're like, can you make it so that you're just playing a game and not like gamified where
- 17:38you just get badges and points?
- 17:39Because with our first business, Skritter, you know, you would get, the users would say,
- 17:44hey, it's so great.
- 17:45It's like a game.
- 17:46And we're like, no, it's a hardcore learning.
- 17:47So what do you mean?
- 17:48It's not like a game at all.
- 17:48I'm like, well, there's, you know, you go fast, there's animations, and then you get
- 17:51points.
- 17:52So like, no, no, no, there's no points.
- 17:53What do you mean points?
- 17:54There's no points.
- 17:54Well, the number of characters, you know, it's kind of like points.
- 17:56There's a graph.
- 17:57A real game would have this, this, this, this.
- 18:00And they're like, that's great.
- 18:00When are we going to get those features?
- 18:02We said, this is a tiny market.
- 18:03And we're already number one.
- 18:04We're not going to build that.
- 18:05Wait a minute.
- 18:06We could build that for this other market, which is much more starting to learn about business
- 18:09and markets here.
- 18:10This portion of Talk Python To Me is brought to you by Linode.
- 18:15Whether you're working on a personal project or managing your enterprise's infrastructure,
- 18:19Linode has the pricing, support, and scale that you need to take your project to the
- 18:24next level.
- 18:25With 11 data centers worldwide, including their newest data center in Sydney, Australia,
- 18:29enterprise-grade hardware, S3-compatible storage, and the next-generation network, Linode
- 18:35delivers the performance that you expect at a price that you don't.
- 18:39Get started on Linode today with a $20 credit, and you get access to native SSD storage, a 40-gigabit
- 18:45network, industry-leading processors, their revamped cloud manager at cloud.linode.com, root
- 18:51access to your server, along with their newest API and a Python CLI.
- 18:55Just visit talkpython.fm/Linode when creating a new Linode account, and you'll
- 19:01automatically get $20 credit for your next project.
- 19:03Oh, and one last thing.
- 19:04They're hiring.
- 19:05Go to linode.com slash careers to find out more.
- 19:08Let them know that we sent you.
- 19:11Could you even do it?
- 19:13And so that's where we spent years and years in the R&D phase, building up code combat, seeing
- 19:19if we could get this interpreter to work, seeing if we could get the game engine to work, seeing
- 19:23if you could get those two things to work together.
- 19:26And that was just a lot of hacking and hacking and hacking, like we do, just sitting in my
- 19:30succession of tiny, now in the Bay Area apartments, and eventually got something going, eventually
- 19:35got those kids not just in JavaScript, which runs in the browser, but you have it in Python
- 19:40too, because the code engine supports these other front-end languages.
- 19:44Which is such a nice learning language.
- 19:46Oh, it's the best.
- 19:47I think Python's special in that regard, in that it's good for learning, but you can build
- 19:52professional things like Instagram or whatever else, right?
- 19:58Pinterest, you name it.
- 19:59It spans that spectrum, which I think is one of its superpowers.
- 20:03Oh, it's so fantastic.
- 20:04And if you look, depending on how you count, Python and JavaScript are the top two languages.
- 20:10Maybe some ways you count Java gets in there in the top three.
- 20:13But to have Python, which is so great for learning, and also so great for everything else, also
- 20:19be so popular to where it could be the default choice if someone doesn't have a reason that
- 20:23they're coming in to learn something else, like, hey, try Python.
- 20:25I think we haven't measured this super exhaustively, but I think it's about a grade level easier
- 20:30than JavaScript.
- 20:31And for what we're doing, Code Combat, it's all basically the same stuff.
- 20:35You're not doing any language-specific things in the beginning, but it's the syntax and your
- 20:40curly braces versus your colons and indentation.
- 20:43Like, you know, it's a whole year worth of, you know, kid development on average, thereabouts,
- 20:48easier to do it in Python.
- 20:51Yeah.
- 20:51Yeah.
- 20:51So you can start sooner.
- 20:52And yeah.
- 20:54So let's, I don't think we formally talked about what Code Combat is.
- 20:58We talked about the history, which is incredible.
- 21:00I had no idea about it.
- 21:01But you tell people what Code Combat, like, what's the experience when you go there as a learner?
- 21:08You talked about playing it as a game.
- 21:09Like, what is it?
- 21:10Yeah.
- 21:10So it's the game for learning how to code.
- 21:13We can qualify that a little bit to say it's aimed at kids age 8 to 18, basically as soon
- 21:18as they can type.
- 21:19Not to say that only kids play it.
- 21:21We have a lot of adults play it.
- 21:23We just aren't marketing it in that audience.
- 21:24Still, what are the best ways to learn to code from scratch?
- 21:28And so you get in there, you're playing a game, you're controlling your hero.
- 21:32In the beginning, you're kind of escaping from dungeons, solving mazes, killing ogres, and
- 21:37you're building your armies.
- 21:39And it progresses from there.
- 21:40So dungeon crawling role playing game in the beginning.
- 21:43And then as you learn more pieces of code, because everything you do in the game, you're
- 21:48coding, right?
- 21:48You can't even move your hero without coding some stuff.
- 21:51But as you go through the game, you get more items.
- 21:54And so this could be a new sword, a shield, a pet, whatever it is.
- 21:58Those things give you new APIs and new control structures.
- 22:02And so as you progress through this really natural game-based learning progression of loot and
- 22:09XP and leveling up and new challenges, it's introducing and making you use and learn and
- 22:15practice different coding concepts and new abilities.
- 22:18So you're not just leveling up your hero, you're leveling up your knowledge of coding.
- 22:22You can do that in Python, JavaScript.
- 22:24We have CoffeeScript, Lua.
- 22:26In China, we have C++.
- 22:28Java could be turned on at any point.
- 22:30All those things go into this code engine because what we're really trying to do is be the best
- 22:35way to learn to code.
- 22:35And so whether it is magic craziness over in the code editor, whether it's kind of deep
- 22:42dive into the code engine, whether it is kind of custom tuning on the game engine and
- 22:46the levels, whether it's just like a look at the overall pedagogy.
- 22:50Everything is trying to get the kids to learn coding and computer science, both more engagingly
- 22:57and more efficiently than otherwise they would be doing.
- 22:59So that is what it is.
- 23:01We do that for kids at home, which of course doesn't need to be kids, but it's usually kids.
- 23:06We'll also now, a new thing we're doing is we will give you a coding teacher on video call
- 23:12to help you go through this stuff as well and maybe explain a little bit more about the concepts
- 23:16around it.
- 23:16And then we also have it in the school.
- 23:19So the computer science curriculum, the new teacher needs to run a full coding class, full
- 23:24computer science class, even if they don't have any coding background.
- 23:27Because you have the self-paced software.
- 23:29I mean, each computer is kind of doing a lot of the instruction in dialogue with the student.
- 23:34And then we provide all the curriculum and lesson plans and resources for the teacher
- 23:38to run that class.
- 23:39And it's been doing pretty well lately just because with COVID-19 and all the school shut
- 23:44down, you need something that's distance learning friendly in the schools that kids might actually
- 23:48want to do, even if they have no better options when stuck in the classroom.
- 23:53Now the whole internet is right there on that same computer.
- 23:55So you got to engage them where they are.
- 23:57And I think it's super engaging.
- 23:58So let me try to talk a little bit about what I think the experience feels like.
- 24:03And it's definitely like what you said.
- 24:04You have these different, you call them worlds, right?
- 24:07Yes.
- 24:07In the home version, you would progress from the dungeon world to the forest world, the desert,
- 24:11the mountain, the glacier.
- 24:13And the kids really, really are excited about the volcano, which doesn't exist yet.
- 24:17But it's kind of like there to tease them.
- 24:19But if you got all the way to the glacier, like, you know, you probably all plus code the volcano
- 24:24because it gets pretty advanced.
- 24:26Yeah, for sure.
- 24:26So what you do is you go into these worlds and then each world has maybe 40 or so little
- 24:34puzzles or challenges, right?
- 24:36So you, if you go to like one here, if I click on it, it'll say, okay, I'm going to descend
- 24:42further into the dungeon.
- 24:43So what I need to do is use a loop to navigate.
- 24:45And then it talks about the lessons I'm going to learn.
- 24:47I'm going to get arguments, basic syntax and while loops.
- 24:49And then when you go in there, you get your little character.
- 24:52And this is like a visual thing, right?
- 24:54It's not like a mud or a text-based game.
- 24:57It's like literally the characters are there, which is super cool.
- 25:01And then when you go do the programming, and this is the thing that I thought was really
- 25:05the magic of what you guys have built is that you've got this nice code editor that's true
- 25:12Python, right?
- 25:13Or the other languages.
- 25:14But I think the Python one is extra special.
- 25:16And when you go there, you type Python code.
- 25:19But the editor has a special kind of autocomplete.
- 25:22I think you would say that is incredibly beginner friendly.
- 25:27So like you might have to type hero dot move, right?
- 25:30Parenthesis, parenthesis.
- 25:32And if you just type the word R or RI, it'll like autocomplete hero dot move, right?
- 25:39It'll complete the whole thing.
- 25:40So you can just type a little tiny bit of what you want.
- 25:42And I think that that's so special because you don't have to form it all.
- 25:47Like if you misspell hero and you type dot in a regular editor, you get nothing, right?
- 25:53Right.
- 25:54Or if you just type the word right, it's like, oh, what you actually have to do is
- 25:56hero dot move, right?
- 25:57So I feel like it's incredibly supportive for writing real code rather than, you know,
- 26:04I think there's this trade-off that people always make.
- 26:06Like, oh, you can do like a blocky scratch language where you drag the blocks around and
- 26:09you get like a looping block and you drag the blocks into the looping block.
- 26:14And it's like, that's maybe programming thinking, but that's far from programming.
- 26:18Yeah.
- 26:19Real code.
- 26:19Whereas this, I feel like it's almost as supportive, but you write
- 26:23real code and you see it actually do things.
- 26:27Well, there's definitely a lot more to writing, even in CoCombat, writing this text-based code,
- 26:32whether it's Python, JavaScript, whatever, than to dragging the blocks around in something
- 26:37like Scratch or Blockly.
- 26:39Those are really great introductions to computational thinking, I would say.
- 26:43And you can actually write a bunch of stuff in there that gets fairly advanced.
- 26:47The problem is you do not learn some of the key skills by doing that.
- 26:53So there are some things that like, yeah, this is just as good for conceptualizing how a loop
- 26:57works or variable or something like that.
- 26:59But you are not building any of the fluency with formal syntax that you're going to need
- 27:04eventually.
- 27:05And you're not building most of your facility with debugging.
- 27:09And, you know, a few other things there.
- 27:11So the problem comes when kids tend to move from those drag and drop block-based visual programming
- 27:17things to text-based.
- 27:19And they've actually learned a lot of coding, computational thinking concepts.
- 27:22But they start facing that blank editor page.
- 27:25They try to type something in.
- 27:26They don't know the syntax.
- 27:27And they feel like they've learned nothing.
- 27:29And a lot of times they rage quit out of coding forever at that moment.
- 27:32And really, they just had a few extra things to learn.
- 27:35And then they can go on and express those concepts they had gotten practice with.
- 27:38But that transfer is pretty hard to show.
- 27:40And people always avoid starting there because it's so complicated.
- 27:44The teachers will have such a hard time with like setting up Python or JavaScript and then
- 27:50debugging it.
- 27:51with this environment being so supportive in the editor, like totally geared for, I'm going
- 27:55to help you write that line of code from, you know, 10 options that you might potentially
- 27:59write.
- 27:59It makes it entirely doable for an entirely different level of learner.
- 28:04Yeah.
- 28:05So the, we had learned a lot from Brett Victor's learnable programming essay when we were starting
- 28:10out.
- 28:11And that we tested out a lot of his more advanced things too, like time travel, debugging, and
- 28:16all this showing the variable state.
- 28:18It turns out a lot of that stuff is not what the learner needs in the very beginning.
- 28:21Although really great thinking.
- 28:23And I'd love to get that some more of that turned back on for more advanced players someday.
- 28:27But the things that you really need to lower that hurdle of formal syntax are just being
- 28:35incredibly forgiving, but sensitive to the kinds of mistakes that people are making.
- 28:38And this goes way beyond what we would thought it would ever come to in terms of what you need
- 28:43to do in that text editor so that students aren't bleeding all over themselves and cutting
- 28:48themselves on sharp edges.
- 28:49So for example, let's say that you, like you mentioned with the autocomplete, you got to
- 28:54do the fuzzy ordering because they're typoing all over the place.
- 28:57So this fuzzy search through your options, and this would never work in a real code editor
- 29:02because you've got hundreds, if not thousands of things that you could autocomplete.
- 29:07It's not going to be a great experience if you're starting to pop up all these options.
- 29:11But when in CoCombat, we can start them off from a set of four APIs and progress adding one
- 29:18or two at a time from there.
- 29:19So they always have a sense of what's available.
- 29:21And then they learn just how many characters or digits they need to type in order to activate
- 29:25those.
- 29:26And that's that smooth progression.
- 29:28Okay.
- 29:28So we knew we were going to need something like that.
- 29:29What we didn't know is stuff like if someone is typing an argument, like a number or a string
- 29:36or something like hero to attack Brack and Brack is the name of the ogre.
- 29:39Every kid out there, they're going to type, you know, maybe hero dot, maybe HA, maybe ATT.
- 29:45They're going to select the attack.
- 29:47Now you, you got to highlight the inside of the quotes for them, because if they just start
- 29:53typing, they're not going to type the quotes.
- 29:54They're going to delete them.
- 29:55They're going to get one off.
- 29:56Those kind of errors are kind of hard to fix.
- 29:58They're going to type, replace the enemy name with Brack.
- 30:01Okay.
- 30:02They're probably going to do it with lowercase.
- 30:03So you have to fire a message that says, Hey, that should be an uppercase B.
- 30:06Leave off the quotes.
- 30:08Probably all those kinds of things you've got to detect, which normally parsers have a hard
- 30:12time.
- 30:12They're like, Oh, I don't know any sort of code here.
- 30:14Like the ending terminus of this string constant literal blah, blah, blah.
- 30:17Not only their message is weird, but they don't know what line it's on.
- 30:20Whereas like, we're like, yeah, we know we have all this data on where students make mistakes,
- 30:24but they need to hear even what error message work.
- 30:26You got to say the right thing.
- 30:27You got to know for that particular program that they're trying to write, which again,
- 30:30a general purpose IDE doesn't know what program you're trying to write.
- 30:33So it can't do this kind of thing, but we can.
- 30:35But then you have to make it so that when they type Brack and they type that K and they hit
- 30:41enter, they always have the cursor inside the string and the parentheses.
- 30:48So in any other code editor, bang, you got an ending quote and ending parentheses on the next line.
- 30:52Like, good luck, right?
- 30:54This one, we're like, you know, for a long time until they're level 30 or something like that.
- 30:59We don't want them to deal with that kind of mistake.
- 31:02So we're just going to move the cursor to the new line and run the code.
- 31:05And so there's a ton of little things like that that you need to do because you don't
- 31:11have the basic facility with text editing.
- 31:12Everything from that to when they're deleting, you need to do extra, extra, extra pauses when
- 31:17you delete to the beginning of the line before you start to go back and delete previous lines,
- 31:22you know, highlighting the way that the indentation works so that visually they can see like,
- 31:26hey, this isn't correct, like error messages that there's all sorts of things that like
- 31:31could technically be valid code, but we have to point out as soon as they do it, like, no,
- 31:35you can't have two while true loops in a program.
- 31:37Like that is not going to make sense.
- 31:39And then one thing too, like you want to have your characters in your game,
- 31:43like doing important, interesting stuff.
- 31:46The easiest way to get them to do more of that is to do an infinite loop where they do the thing.
- 31:51But while they're coding that loop, if they don't have a blocking action inside the loop,
- 31:56normally then your program grinds to a halt because time doesn't pass.
- 32:00And so all sorts of crazy hackery inside the engine whereby they're writing fully general
- 32:06purpose code, but we're digging in and saying, hey, does this frame have this or that kind of
- 32:10continue or break or condition?
- 32:12If not, we're going to add an extra like one frame blocking action to this and remove it.
- 32:17If once they add an action that does something like moving or attacking or saying or something
- 32:21like that, so that there's this magic behind the scenes that you need to do where it's technically
- 32:27not how the code execution would happen, but it matches their mental model much, much better.
- 32:33And then later when they get into conditionals, then you start to take that away and show them
- 32:38what happens when infinite loop, which again, isn't just crash the browser tab.
- 32:41It's like, hey, here's your infinite loop.
- 32:44I disabled your hero and then he got killed.
- 32:46So maybe you want to fix this by putting that here.
- 32:50Your hero got tired and just like ran out of water or something.
- 32:53A red X showed up under the one that didn't work.
- 32:56Yeah.
- 32:56So you have to do all these sort of things.
- 32:58So like every sort of error makes sense, not just in the context of the code editor, but
- 33:03also in the context of the game.
- 33:05And you would never be able to do that if you hadn't written and have full control over
- 33:09the stack and execution of your entire program.
- 33:11So the custom interpreter that we've written has that like, because it will run Python,
- 33:17JavaScript, you know, whatever language that you provide a runtime adapter to a JavaScript,
- 33:23a Mozilla ASD.
- 33:25So that abstract syntax tree gets executed by our interpreter.
- 33:28And then whenever it calls out to something that doesn't exist in JavaScript or needs to behave
- 33:31differently than in JavaScript, you know, that that we have a runtime language component that
- 33:36makes it behave like that.
- 33:37And being able to do it from, you know, top to bottom and back up lets you go in and mess
- 33:45around with whatever layer of execution you need to.
- 33:47This is where it like helps to actually have had that computer science class in college and
- 33:51kind of understand how the compiler works.
- 33:52Mess around in there.
- 33:54But this stuff you have to do, you're like, oh, the student is messing around with this.
- 33:58So we need to fuzzily check in this level.
- 34:00We have these kind of possible strings that could work and these ones that shouldn't work.
- 34:04And so over here, if they have a fuzzy match typo, we're going to adjust this error message
- 34:09over there.
- 34:09You need to do so much of that.
- 34:10But when you do, they don't need to ask teacher.
- 34:13They don't need to ask parent.
- 34:14They don't need to like bang their head against the wall for an hour.
- 34:16They just get it.
- 34:18And that's really key for anyone learning anything.
- 34:21But like, especially young kids learning something that like maybe is a little bit disconnected
- 34:26from what they see other kids around them doing and wanting to do.
- 34:30And, you know, that's that kind of thing if you want to get any kid into it.
- 34:34Yeah.
- 34:34I think you guys have done a really good job with the way you put that editor together.
- 34:37It's super helpful.
- 34:39It's clear that it's focused on helping beginners.
- 34:43And I think the way that you put it together, you don't even have to really be able to type
- 34:48in the traditional, like, you know, Cordy, don't look at the keyboard type of typing, which
- 34:54you kind of need for programming.
- 34:55You need to know, okay, where are the R and the I?
- 34:58I mean, you got to sort of know, but like a fifth grader could totally do that, who maybe
- 35:02just touch types without getting frustrated.
- 35:04Because really, to solve a puzzle, you're probably doing eight, nine lines of code on a long one.
- 35:08And you've a couple characters per line, right?
- 35:11It's not that much of typing, but they still get that real experience.
- 35:15And that's what I think is super special about what you guys have built compared to all the
- 35:19other stuff that looks fun, or it's very approachable, like the blocky type languages.
- 35:24But it has that big crossing the chasm sort of thing to go from there to like textual text-based
- 35:32languages.
- 35:32Yeah.
- 35:33The amount of typing that you need will increase.
- 35:37And the amount of difficulty of each level increases as you get further through the game.
- 35:41So, whereas, you know, your middle schooler can probably do most of, I don't know, we have
- 35:47like 600 some levels.
- 35:48Maybe they can get through the first 400.
- 35:50It really depends on them.
- 35:51To do the later ones, they'll probably need to work through it with a teacher or a coach
- 35:54just because all this stuff actually does get kind of complicated.
- 35:57You're implementing some graph search algorithm.
- 35:59Like, yeah, but you're 12.
- 36:01So maybe let's talk about the graph search algorithm instead of just, you know, sitting out in front of
- 36:06the computer and banging that out there.
- 36:07But the really young kids can do the easy levels that you see where you're like, let's move
- 36:11right.
- 36:12Let's move up.
- 36:12Let's attack the ogre.
- 36:13Let's use the potion.
- 36:14Let's do a while loop.
- 36:16While loops, variables, function calls, not defining function, but function calls, XY coordinates,
- 36:24all those things, any of these kids can get with the right kind of setup.
- 36:29And then when you get into if statements, then you're thinking like, okay, well, this might
- 36:35be a good stopping point for some five, six, seven year olds.
- 36:40Others can totally get it.
- 36:41I just saw a recorded video class that one of our teachers did with this.
- 36:46I think he's eight in Hong Kong.
- 36:48And the guy's like almost all the way through the mountain.
- 36:50He's like commanding his armies.
- 36:52He's he's doing different ways of looping over indexes.
- 36:55I don't think he quite got to the module arithmetic, but like, you know, some of these kids are capable
- 36:59of so, so, so, so much and they get super into it.
- 37:02Talk Python To Me is partially supported by our training courses.
- 37:06How does your team keep their Python skills sharp?
- 37:10How do you make sure new hires get started fast and learn the Pythonic way?
- 37:14If the answer is a series of boring videos that don't inspire or a subscription service you
- 37:20pay way too much for and use way too little, listen up.
- 37:23At Talk Python Training, we have enterprise tiers for all of our courses.
- 37:26Get just the one course you need for your team with full reporting and monitoring or ditch
- 37:32that unused subscription for our course bundles, which include all the courses and you pay about
- 37:36the same price as a subscription once.
- 37:39For details, visit training. talkpython.fm/business or just email sales at talkpython.fm.
- 37:46And other kids like, hey, we'll just go and do as much as you're ready for now.
- 37:52And maybe you come back to this in a couple of years as some of this abstract thinking gets tougher.
- 37:55But my three-year-old, I had him start doing it.
- 38:00And, you know, at that point, it's like 20 seconds to find the R key.
- 38:04But then he types R and he can move to the right.
- 38:06And actually meant to move to the left.
- 38:08But like, you know, two minutes later, he's fixed it.
- 38:10And he pressed the delete key and deleted everything.
- 38:12You need to be despite all our protections.
- 38:14But of course, I wrote the program.
- 38:16So I'm like, OK, let's press the reset button over here.
- 38:18But like he's gotten through several dozen levels.
- 38:21He's five now.
- 38:22So you can see how fast he goes through it.
- 38:23But he gets super into it.
- 38:25So it's not nearly when you're learning to code.
- 38:28It doesn't matter if you're 5, 15, 25, 35.
- 38:31Everybody's starting at the beginning.
- 38:33And there's so few good software pieces out there to help you with that.
- 38:38That it's one of the best ways, I think, to get started for anyone.
- 38:42So that motivation from the game-based format is extra helpful at these young ages.
- 38:48But it doesn't hurt anywhere.
- 38:49Yeah, no, it's pretty cool.
- 38:51Maybe we could talk through the different worlds.
- 38:53So I got to figure out how to get back to it.
- 38:56Yeah.
- 38:56So you start off in Kithgar Dungeon.
- 38:57This is the hardest piece to design because they know almost nothing.
- 39:01And so you have to build up every piece of it from scratch.
- 39:05And in a normal learning environment, that'd be pretty hard to design because it's just throwing
- 39:09the book at them.
- 39:10But in this one, we can vary the game scenario too.
- 39:13So even if you need to do five or six or seven levels in a row where you're going from just
- 39:18moving right up, down, left.
- 39:19So maybe you do that, but there's an optional argument for how many times to move.
- 39:24And then you've introduced arguments.
- 39:26Now you can introduce an attack method where you can then put a string in there.
- 39:30And you very slowly pace it out, but it keeps fresh because throughout you're getting new
- 39:35items, you're getting new game scenarios, you meet new enemies, and different art all the
- 39:40time.
- 39:40So they're really thinking like, hey, I'm exploring this game.
- 39:43And it does take a bunch of levels to get these basics in place.
- 39:47But you get through that in the first dungeon, which people, you know, some kids are doing
- 39:51this in a couple hours.
- 39:52They've got, they can write code like move, hero.move down, hero.move down, hero.buildxy,
- 39:59fence, 3420.
- 40:00And then they have three different coordinate pairs of where they build their fence.
- 40:03And they'll say, well, true, move, right.
- 40:05And so that moves their hero down.
- 40:07There's a bunch of ogres coming at them.
- 40:08They're building fences to block off the attack.
- 40:10And then they move until they get to the end of the dungeon and get the gem.
- 40:13And that's the last level of the dungeon.
- 40:15That one doesn't have a variable in it, but they also have variables in there.
- 40:18So they can move up enemy equals hero without find your enemy attack the enemy.
- 40:22They don't have any if statements yet.
- 40:24So as we get into the forest and it opens up and we should have done this from the beginning
- 40:27where the dungeon is still kind of more appealing to the boys because, yeah, let me get in this
- 40:32dank dungeon.
- 40:32It's kind of dark.
- 40:33Let's hack some ogres apart.
- 40:34It's not as violent as, you know, you would think from the name and the first setting,
- 40:38but we sure could have made some different design decisions there.
- 40:41So then you get into the forest and there's a lot of that, but there's a lot of like,
- 40:45okay, let's corral our horses.
- 40:47Let's build other things.
- 40:48Let's defend the village.
- 40:49Let's, you know, go and talk to the villagers.
- 40:51And so there you're introducing if statements and Boolean logic.
- 40:55You get your pet.
- 40:56You got your pet earlier, but you didn't know how to do anything with it.
- 40:58Now you can write event handlers and functions so that your pet can be doing stuff for you.
- 41:03And you're of course increasing your kind of normal fighting capabilities.
- 41:07You get to your first multiplayer arenas where you're writing your Python AI hero.
- 41:12So use all your heroes capacities that you developed and you're either trying to get more gold than
- 41:16the others or you're trying to just kill them or defeat them.
- 41:19And, you know, from there you would move on into the desert.
- 41:23And here we're doing more with numerical arithmetic.
- 41:26I mean, this whole time you've been getting into the XY coordinates.
- 41:29Now you can add them, subtract them.
- 41:31You can do break and continue statements.
- 41:33Arrays, for example.
- 41:34Arrays start to happen in there.
- 41:36You start to get object, a lot of it too, in the desert.
- 41:40Because once you start to get arrays, you can do a lot more interesting tactics.
- 41:45So you're, you know, arrays with this other stuff,
- 41:47let's see you implement algorithms of, you know, finding the closest enemy,
- 41:51finding the weakest enemy, finding the closest weakest enemy,
- 41:54finding the coins, finding only the right type of coins, finding the best ones.
- 41:57You're like optimizing all this stuff.
- 41:59And that's really interesting for when you're kind of fighting in some of these battles.
- 42:03Then once you get into the mountains and we're introducing while loops over indexes of the arrays and for loops over the arrays,
- 42:11and 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:18moving in different patterns to draw the kind of the flowers that go behind you in this flower ring.
- 42:22There'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:32Whether that's to, you know,
- 42:33whether that's to use your bash ability or shield or cast your magic spells or go invisible.
- 42:37And the kids really love getting the new capabilities like that.
- 42:41Yeah.
- 42:41My 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:49And it was, yeah, it was, it was great.
- 42:51Yeah, yeah, yeah.
- 42:52And 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:59really well in some of these tournament arenas that will run, then the glacier will happen.
- 43:05And the glacier is kind of like, all right, let's introduce the vectors.
- 43:07And now you're doing vector arithmetic.
- 43:09So operating with these various like linear algebra transforms only to you.
- 43:14It's not been a linear algebra transform.
- 43:15It's like, okay, vector dot rotate.
- 43:17And let me think about it.
- 43:18This is where it starts to get a little tricky.
- 43:20We're introducing kind of the Boolean logic and, you know, counting in other bases and some of these graph search algorithms.
- 43:28There's one where you just have to code up your team to play soccer for you.
- 43:32And like, that's a lot of geometry and trigonometry there.
- 43:35But some kids get that far by themselves.
- 43:38Most of them will need to work through that with a teacher.
- 43:40Yeah, it's cool.
- 43:41And just to give people a sense, like the first engine, there's 43 puzzles, puzzle programs you got to write.
- 43:47The forest has 121.
- 43:49And the desert has 97 and so on.
- 43:52So there's a lot of little problems that the kids can go solve and work on.
- 43:57And they're pretty bite-sized.
- 43:58So it's quite cool.
- 43:59The 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:06So there's a lot of content in there.
- 44:09There's also a lot of hidden content that shows up if you, the system determines you might need a little bit more help.
- 44:14Or if you go back and then you unlock secret stuff in the earlier worlds.
- 44:18Because everyone is learning at different rates, they're going to need different amounts of practice on the same concepts.
- 44:23So if you're doing levels particularly slowly or particularly difficulty, the system might say, okay, here's the next level.
- 44:29But it's actually a practice level.
- 44:30Some other student might not have gotten that level if they didn't need it.
- 44:33Oh, interesting.
- 44:34Yeah, that's clever.
- 44:34So it can slow it down if you need to.
- 44:37We don't have a way to really speed it up.
- 44:39But then again, learning this thing is already going pretty fast.
- 44:42Yeah, for sure.
- 44:43Awesome.
- 44:44Well, I think it's a really cool world you've created for these kids and basically beginners in general.
- 44:48But it definitely seems like it's going to connect with the kids.
- 44:51I know it did with mine.
- 44:52So let's talk about some of the internals.
- 44:55Yes.
- 44:56You talked about the different languages.
- 44:57We write Python in the browser in this cool editor with a special autocomplete that we talked about.
- 45:04Where does it run?
- 45:05So it runs right there in your browser.
- 45:07And there's a few pieces of magic to make this happen.
- 45:10So the first is we use the Ace text editor.
- 45:14And then we've heavily customized that.
- 45:16But it's a really, really great, fantastic base layer for doing all sorts of crazy stuff with your code editor.
- 45:21So 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:32Even pre-running it in advance.
- 45:34So that once they hit run, the entire world is simulated in the background thread.
- 45:38And we just swap out the front-head state with kind of like a video-like playback.
- 45:41You can scrub back and forth with what happened.
- 45:43So that's all this custom code simulation game engine stuff.
- 45:48But what makes it possible are these two libraries.
- 45:52So one is Sculpt.
- 45:53And that is kind of the Python in the browser implemented JavaScript interpreter parser thing.
- 46:00And that is implemented so that you can actually run full Python programs as much as you can.
- 46:05We'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:15And that ends up giving a crazy error message.
- 46:17So, you know, picking pieces of Sculpt out there and then augmenting them with our own systems.
- 46:24And some of this you can start to get crossovers.
- 46:26So a library for code linting that works for JavaScript.
- 46:29And we've turned the AST into a Mozilla JavaScript AST format.
- 46:34Then you can start to run some of these tools that were designed to work on JavaScript.
- 46:37But you're giving useful information for Python.
- 46:39So that's pretty cool.
- 46:41That's awesome.
- 46:41It is all on top of this thing that we wrote called esper.js.
- 46:45And esper.js is designed to be the kind of controllable, pumpable, beginner-friendly interpreter that runs in the browser.
- 46:52But takes multiple languages.
- 46:55And so there's a Python plugin for it.
- 46:58There's a Lua plugin for it.
- 47:00As much as you need to do, there's a CoffeeScript plugin for it.
- 47:03And then those things, it's two pieces.
- 47:07The parser piece.
- 47:08So the parser piece, we're relying a lot on Sculpt.
- 47:10And we'd previously written our own.
- 47:11And it just wasn't very good.
- 47:13So we moved over to Sculpt on there.
- 47:15And then the runtime library piece where you can take some pieces of that.
- 47:19But really for performance, you're implementing a lot of Python functions and modules in this kind of interpreter language
- 47:27where you're operating on abstract syntax tree nodes.
- 47:30You could just pull in that part of the Python library or write it in Python and then just run it.
- 47:37But it gets pretty slow.
- 47:38So you'll kind of bring in the hot loops and pull those in natively in Esper itself, in Esper's Python plugin.
- 47:46So 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:59Esper is fully open source.
- 48:01So is the Python plugin.
- 48:03And 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:14Definitely check out Esper.js on GitHub.
- 48:17If 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:22Right.
- 48:22If you don't need to reinterpret what the instructions mean and like capture them and whatnot, right?
- 48:27Like you have a kind of a special use case here, I suspect, and what you're trying to do.
- 48:32Well, there's a lot of people that go and want something like this.
- 48:36So some of the projects are using Esper.
- 48:38I 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:53Because, you know, you're running this thing in your user's browser.
- 48:56You know, maybe you're pulling in code that someone else wrote into that.
- 48:59You got to make sure that it can't break out.
- 49:01And 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:08Make your own copies of them, whatever you want to do.
- 49:10It's pretty good.
- 49:12Yeah, that's pretty neat.
- 49:13In Python or in other languages.
- 49:15Yeah.
- 49:15Did you consider something like Docker, like a server side solution as well?
- 49:20Or was it always we've got to do this on the front end?
- 49:22You know, after seeing Brett Victor's talk on learnable programming, which is fantastic.
- 49:26So if you haven't seen it, you know, stop listening, go check it out.
- 49:29I mean, no, this is probably kind of interesting, but that is so interesting.
- 49:33So the idea there is this kind of run it on the server and send the result back format.
- 49:38Is kind of old school algorithms competition kind of thing going on?
- 49:42Yeah.
- 49:42Yeah.
- 49:42Super secure.
- 49:43Take some server resources, which you can probably figure out how to get working.
- 49:46But it's limited in the bandwidth of what it can tell you back.
- 49:50So 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:58Really, you're sending back the answer.
- 50:00Yeah.
- 50:00But what we want for a rich, immersive gameplay world is we don't want to just know the answer.
- 50:05We want to see everything about how this code is executing because it can touch every part of the world.
- 50:10So if you wanted to do that, you have to run the whole thing on the server.
- 50:16And 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:27And 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:38And you kind of have the same thing going on here.
- 50:41But 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:56Anything can happen.
- 50:57So 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:03So if you sent that to the server, you'd be downloading like 15 or 20 megabytes every time you ran the code.
- 51:08I 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:17Just tell me the answer.
- 51:18Then like I'm playing this here in my browser.
- 51:20So that's, that's why we didn't do it there.
- 51:23Yeah.
- 51:23And 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:30Yeah.
- 51:31Right.
- 51:31So you'd have to do it on the server side anyway.
- 51:33It sounds like you can't just drop it in and hit it with C.
- 51:36Well, 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:43And JavaScript, I love it.
- 51:45It's a great language.
- 51:45It's basically scheme in Java's clothes.
- 51:49And 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:58So, 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:04And that would be pretty advantageous.
- 52:06And there's a lot of these most, we, at some point we're looking at teaching like dozens of program languages way.
- 52:11And you look and say, okay, who's implemented an interpreter that I can use or a parser that I can use.
- 52:15And it's all implemented either in the language itself or something like C or something like that.
- 52:19You can't use any of that in the browser.
- 52:21So it could have saved some work, but, you know, we really wanted it.
- 52:25Like, write some code, click the button, immediately see what happens and enrich detail and be able to like scroll back and forth.
- 52:33We want to send the entire state of the world so you don't just see it once.
- 52:36We want to have it render as fast as we can so you know if there's any bugs or any errors.
- 52:41And then we want you to be able to play back, go back and forth, time travel, debug, any of that stuff.
- 52:46So we kind of over-engineered it in the beginning after seeing that talk and happy with how that turned out.
- 52:53But, yeah, it's a lot of work.
- 52:54Yeah, well, it definitely helps on the scaling side of things.
- 52:57Oh, yeah.
- 52:57The other thing that you can do, because the user's browser knows how to not just run the game but their code,
- 53:02when you go to do the multiplayer pieces, our server doesn't do anything either except for say like,
- 53:07hey, peer-to-peer distributed simulation net, you simulate some games here,
- 53:11and then they report the answers back and we just keep a leaderboard.
- 53:14But, like, we'll be distributing all these other players' games to everybody who's, like,
- 53:18trying to play one of these multiplayer levels, and then you get this automatic, like,
- 53:21simulated ladder thing for no compute.
- 53:23It's pretty great.
- 53:23Yeah.
- 53:24Yeah, that's pretty awesome.
- 53:25Cool.
- 53:26Well, it's definitely neat to see you guys taking some of these Python in the browser initiatives
- 53:32that there's not a whole lot of other people doing, like, real work with, right?
- 53:38Like, building real tools.
- 53:39You know, the guys over at Anvil, they build a pretty interesting system based on Sculpt as well.
- 53:45A lot of cool designers and front-end tools, basically.
- 53:47Have you seen Anvil?
- 53:49I'll have to check it out.
- 53:50Yeah, so Anvil is a way for building, like, simple hosted web apps.
- 53:54Go there.
- 53:55And they've got, like, a component gallery of buttons and text boxes.
- 54:00You drag them over.
- 54:01And then all of those have events.
- 54:03You double-click it and it switches over to see the code.
- 54:05But that's all Python code that runs in the browser on Sculpt.
- 54:08Oh, that's awesome.
- 54:10Yeah, so it's pretty awesome.
- 54:11There's also Brython out there, too, for another take on it.
- 54:15Yep.
- 54:15Did you look at Brython and consider it alongside Sculpt?
- 54:18It wasn't as far as along when we kind of put our stuff together.
- 54:21But, you know, I think either of them could potentially have worked.
- 54:25We just needed a parser layer from it.
- 54:27I can't remember if Brython would use the Mozilla AST format or something else.
- 54:32Right.
- 54:32I think this is great.
- 54:34Well done on building it that way.
- 54:35So let's just talk briefly about the business side of things.
- 54:39I think it's always interesting to see people building businesses on Python and bringing
- 54:43these tools together and whatnot.
- 54:45Yeah.
- 54:45So I guess, first of all, we haven't talked about this yet for people who don't know.
- 54:50Like, is there something I pay for?
- 54:52It's Code Combat free.
- 54:54What's the story?
- 54:54Yeah.
- 54:55So we are an open source project.
- 54:58And, you know, it goes back to my roots with my dad having that Mr. House home automation
- 55:02project, which it just seemed like back in the day, that was like the thing you did was
- 55:05cool.
- 55:05And when we started building this business, we weren't thinking about open source, but we
- 55:08knew we wanted to do a for-profit business because that's how you can get the resources
- 55:11to really make great software.
- 55:12And, you know, there's obviously going to be a big market for people learning how to code.
- 55:16So we built this thing, built this thing.
- 55:18It was free for a long time.
- 55:19I said, hey, we're going to start charging for this thing.
- 55:20But that was kind of still in the mind, like there's going to be a lot of people who can't
- 55:24afford however much you're going to charge that still should be able to learn to code.
- 55:27And especially if your game is multiplayer, you kind of want those players anyway.
- 55:30So not just to provide network effects for playing the game, but also for sharing the game.
- 55:35So the initial model we did is a $10 a month subscription, but freemium.
- 55:40So you only have to pay for that if you want the extra levels, extra heroes, extra gems,
- 55:45some of this game content stuff.
- 55:48But it's not like you get the first 20 levels for free and then you have to pay.
- 55:51It's more like you get the core progression of levels from the beginning all the way to
- 55:55your crazy graph algorithms in the end.
- 55:57And then it's extra practice levels that are kind of the branches of the tree that you would
- 56:01pay for.
- 56:02So if you want more help with that, you just want more content, you want a cool hero as
- 56:06opposed to the basic hero, then you can subscribe.
- 56:08And so most players, you got a couple hundred thousand monthly active players.
- 56:13Most of those are just playing for free.
- 56:15We kind of made a mistake because when we started to take off as a business, we had all
- 56:19these players.
- 56:20We said, OK, well, the main market for this is going to be in the schools.
- 56:23And in the schools, you have this huge need for teachers to be able to deploy some computer
- 56:28science curriculum that kids will actually do, even if the teacher is not there over their
- 56:32shoulder all the time.
- 56:33And especially if the teacher is not a pro coder, which, you know, if you're a pro coder
- 56:37and you're working in teaching, I salute you because that's a really hard job.
- 56:40You probably know where you can make elsewhere and it's more than twice what you can make
- 56:43as a teacher.
- 56:44So not a lot of super experienced coders in teaching and all of these teachers getting
- 56:49deputized to teach computer science.
- 56:51The math teacher has to teach it.
- 56:53The English teacher, the choir teacher has to teach it like help.
- 56:57Right.
- 56:57So they reached out.
- 56:58We said, hey, you know, we can help you run this with your students.
- 57:01Let me see what we do, built the teacher dashboard and our main product is now that classroom
- 57:04version.
- 57:04And so when we made a bunch more content for that, we actually forgot to set it as paid
- 57:10on our on our home version.
- 57:12And so there's a couple of hundred free levels like you could just do so much there.
- 57:16And it's not the main way we make money.
- 57:19So I'm cool with that.
- 57:20We're not trying to optimize that to within an inch of its life in terms of conversion funnels
- 57:24or anything like that.
- 57:25So, yeah, it's great.
- 57:26We make a little bit of money from that business, but it also means you can just go play for free.
- 57:30You don't have to sign up, try it out.
- 57:31And if you wanted that extra help or extra content, you can get that.
- 57:36Now, the new thing is if you want extra help, you can pay for private lessons from one of
- 57:42our online coding teachers.
- 57:43You know, they'll work an hour or two hours a week with your kid or you can do group classes
- 57:47with up to four other students, up to four students total.
- 57:49And so those are some ways it works.
- 57:52We've got some different pricing models in China where we run our business too.
- 57:56But as an open source project and with this kind of community in mind, this helped us
- 58:01so much.
- 58:01Like, it's great to be able to give back and make a bunch available for free.
- 58:04Yeah.
- 58:05We wouldn't even have Python if it weren't for open source.
- 58:08When we launched, we only had JavaScript.
- 58:10And one of the first major contributions, we ran this like programming language edition
- 58:15like contest.
- 58:16I think we gave away like a MacBook and an iPad or something.
- 58:18And for that, we got Python and Lua and like all these parts.
- 58:21Even someone did Clojure.
- 58:23And we're like, dang, that was really efficient.
- 58:25And we hired two of them.
- 58:26And like going open source was just super interesting.
- 58:30But yeah, that we have this ethos where if you need to learn to code, you can use us.
- 58:34I'm not going to charge you.
- 58:35Yeah.
- 58:36So there's like a free path through these worlds.
- 58:38If you want, you can take it, but you can pay for more.
- 58:41Yeah.
- 58:41Pay for the side branches of the learning path, basically the learning tree.
- 58:44Yeah.
- 58:45Cool.
- 58:45Well, that seems like a pretty solid model to me as well.
- 58:49So maybe let's close this out with two quick questions.
- 58:52One, what's coming in the future?
- 58:54Do you guys have any like cool things that you're adding or just keep going, adding content?
- 58:59Well, we have in the classroom, the new thing is Ozaria.
- 59:03So as we put these teacher features on for based on the home product, you know, we learned a lot.
- 59:09We ran over 80,000 educators through this thing.
- 59:11And over the last two years, we've been building out an all new series of content.
- 59:16Now we're putting it with new brand.
- 59:18It's got new learning modes, got all this story.
- 59:21And that is going to be the primary classroom product starting in next month, basically.
- 59:26So that's at Ozaria.com.
- 59:28And you can't play that on your own really, because that's meant for the teacher experience.
- 59:33But, you know, if there's a school involved, then they should, they'll be using that and
- 59:37they'll have, it's really cool.
- 59:39So that's the new thing on the classroom side.
- 59:42The new thing on the home side is of course, we have added this online teaching and that's
- 59:46growing pretty well.
- 59:47So just kind of expanding what we're doing with that in China, getting it translated into
- 59:52even more languages, adding C++ and Java and kind of capitalizing on the potential of what
- 59:59we're doing.
- 59:59Like you say, there's, there's all these things you can do to optimize every error message in
- 1:00:03every level.
- 1:00:04And of course, we haven't done that with everything.
- 1:00:06So there's just so much more of the core of polish of what we want to do.
- 1:00:09Right, right.
- 1:00:10Each little challenge can have like its own special messages and sort of help support that.
- 1:00:17I'm sure that can always be polished.
- 1:00:18Oh, yeah.
- 1:00:19It's unbounded what the kids are going to mess up.
- 1:00:21Yeah.
- 1:00:21Eventually we need to hook up a machine learning system here that's really doing, I mean, something
- 1:00:25simple, like a multi-armed bandit system or something like that, where we're measuring
- 1:00:29the effectiveness of every possible intervention point, put it in there and optimizing all of
- 1:00:33that based on the data, as opposed to kind of digging into the hotspots by hand and game
- 1:00:37designers going into it.
- 1:00:38But that's what's up for us, just getting better and better and better at teaching coding and
- 1:00:42into more context, more people, more languages.
- 1:00:46Yeah.
- 1:00:46We're up to.
- 1:00:46Yeah.
- 1:00:47Cool, cool.
- 1:00:48And last question, COVID completely changed education.
- 1:00:53Yeah.
- 1:00:54It's probably going to change it in the fall for at least in the United States and some
- 1:00:57other places.
- 1:00:58This has got to be a boon for you guys to say, look, we have this opportunity to reach
- 1:01:04out to many more people who need education and maybe, like you said, more remote friendly
- 1:01:09education.
- 1:01:09Oh, yeah.
- 1:01:10It was originally, you know, we have our team in China and China got shut down.
- 1:01:14And a lot of the stuff we were selling in China was offline training centers after school.
- 1:01:17So we took a hit.
- 1:01:19We saw it coming.
- 1:01:20And we even hired an epidemiologist in late February to say, hey, what's going to happen?
- 1:01:24So she saw everything coming.
- 1:01:25And we're like, hey, sound the alarm, guys.
- 1:01:27This is bad, but we can help.
- 1:01:29And so just as awful as it's been in most dimensions for our business, like it's relatively good.
- 1:01:37The intersection of online learning and online gaming for us, it's just this big opportunity
- 1:01:42to help out in these trying times.
- 1:01:43So like my kids, my five-year-old will be going to kindergarten.
- 1:01:46Oh, that's off.
- 1:01:47You have kids that like, you know, maybe you're not going to be in as much school as you'd hope,
- 1:01:51but you want something for them to do at home.
- 1:01:53Have them check out Code Combat.
- 1:01:55If you really want them to have some structure, get one of our teachers for that or share it
- 1:02:00with your school and we can help out.
- 1:02:01So that is, you know, as long as this thing looks like it's going to be with us, we'll be
- 1:02:07adding more and more of this stuff that makes it even easier to do it from a distance.
- 1:02:10Yeah.
- 1:02:10Well, fingers crossed that it doesn't stay with us for too long, but what you guys have
- 1:02:16built will definitely, you know, help fill the void, I think.
- 1:02:18Yeah, thank you.
- 1:02:19Yeah, sure.
- 1:02:20All right.
- 1:02:21Well, before we get out of here, let me ask you one of the two questions I'll ask at the
- 1:02:27end.
- 1:02:27So if you're going to write some code and, you know, we were talking right before we hit
- 1:02:32record that working on this for Python, this is really mostly a JavaScript project, much
- 1:02:38like working on the visualization tools for say like Jupyter Notebooks, right?
- 1:02:42Even though it's for Python in some sense, like the creating of it is in a JavaScript.
- 1:02:47So what tools do you guys use to write your code to work on this?
- 1:02:51Yeah.
- 1:02:52So our engineering team is all over the place on editors.
- 1:02:55When you have your kind of JetBrains stuff, you have your Visual Studio, your VS Code, you
- 1:03:01have some LimeTags.
- 1:03:03I started this with Emacs and I'm still on Emacs.
- 1:03:06I'll be on Emacs forever because I'm like arcane techno amoeba of Emacs that nobody can
- 1:03:10understand.
- 1:03:11So you're sticking to your scheme roots, your Lisp roots?
- 1:03:14Oh, yeah.
- 1:03:15I'm not that great in Emacs Lisp Packer, but I got a few macros here and there.
- 1:03:19Probably for my cold dead hands.
- 1:03:21Yeah, right on.
- 1:03:22Awesome.
- 1:03:22All right.
- 1:03:23Now, final call to action.
- 1:03:24People are excited about this.
- 1:03:27They want to try it.
- 1:03:27Maybe want to try it with their kids.
- 1:03:28Yeah.
- 1:03:29What do you say?
- 1:03:29CodeCombat.com /play.
- 1:03:31No sign up.
- 1:03:33Just pop it in front of them.
- 1:03:34See how they do.
- 1:03:35And if there's a teacher in your life or a school, that would be the Ozaria product.
- 1:03:40Ozaria.com.
- 1:03:41Send it to them and see if we can get their school hooked up.
- 1:03:44There's a bunch of free stuff there too.
- 1:03:45And a lot of people are looking for this.
- 1:03:48So, yeah.
- 1:03:49Awesome.
- 1:03:49Thanks for the time.
- 1:03:49This has been really fun.
- 1:03:50Yeah.
- 1:03:51It's been great to talk to you about it.
- 1:03:51And congrats on the project.
- 1:03:52I think it's really opened up like proper coding for a whole nother level.
- 1:03:58And I'm really happy to see it.
- 1:03:59Yeah.
- 1:04:00Yeah.
- 1:04:00Yeah.
- 1:04:00All right.
- 1:04:01Take it easy.
- 1:04:01All right.
- 1:04:02Bye.
- 1:04:02Bye.
- 1:04:02This has been another episode of Talk Python To Me.
- 1:04:06Our guest on this episode was Nick Winter.
- 1:04:08And it's been brought to you by Linode and us over at Talk Python Training.
- 1:04:11Start your next Python project on Linode's state-of-the-art cloud service.
- 1:04:16Just visit talkpython.fm/Linode.
- 1:04:19L-I-N-O-D-E.
- 1:04:20You'll automatically get a $20 credit when you create a new account.
- 1:04:24Want to level up your Python?
- 1:04:26If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
- 1:04:31Or if you're looking for something more advanced, check out our new Async course that digs into
- 1:04:36all the different types of Async programming you can do in Python.
- 1:04:39And of course, if you're interested in more than one of these, be sure to check out our
- 1:04:43Everything Bundle.
- 1:04:43It's like a subscription that never expires.
- 1:04:45Be sure to subscribe to the show.
- 1:04:47Open your favorite podcatcher and search for Python.
- 1:04:50We should be right at the top.
- 1:04:51You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 1:04:56and the direct RSS feed at /rss on talkpython.fm.
- 1:05:00This is your host, Michael Kennedy.
- 1:05:02Thanks so much for listening.
- 1:05:04I really appreciate it.
- 1:05:05Now get out there and write some Python code.
- 1:05:06I really appreciate it.