Settings

Theme

Show HN: TeachCraft – Learning Python Through Minecraft

github.com

129 points by emeth 10 years ago · 27 comments

Reader

jackhack 10 years ago

Is this project related to the book: "Learn to Program with Minecraft: Transform Your World with the Power of Python" ? http://www.amazon.com/Learn-Program-Minecraft-Transform-Pyth... I ask because the concept appears to be substantially similar.

re: the approach -- My kids are crazy about Minecraft, and being able to build very simple python programs that modify the world (build block structures, control creatures, etc.) is much more gentle yet engaging than the typical programming 101 tasks.

bpchaps 10 years ago

Neat, I'd also recommend something like opencomputers for learning. The learning curve and asinine amount of time it takes to get started is a bit of a hurdle or thirty, but it helps to have more than one person involved.

At the end of my adventure with it, I had some code that would read a png from github from minecraft, then use the 3d printer to create a series of blocks by using the 'pixels' from all server allowed blocks. The personal requirement was to not do any sort of color manipulation and only use what was available. The pixel position from block to block doesn't change, and transparency could be coded outside of the png, so it became pretty damn difficult really quickly.

In the process I got to learn about png, cv2, jit (to pull the available blocks' pngs and eventually for an attempt in finding consistent transparency logic. Flowers.....), minecraft's internals, voxels, some lua, more python and some interesting algorithm stuff.

Life got in the way and I never actually finished, but the block directly to the left of the cursor was the last block created. Despite its ugliness, I'm actually pretty pleased with it. https://imgur.com/dqwnnL2 which is part of https://imgur.com/gallery/giajLha (dickbutt baby, nsfw kinda)

hakcermani 10 years ago

This is awesome. Much more engaging than finding the first 100 primes.

  • Alex3917 10 years ago

    I think it's really time to move on from math puzzles in most programming classes and hiring interviews. If people enjoy doing Project Euler problems or find them beneficial then that's great. But using them to 'teach' others is like forcing your own weird fetish on unsuspecting strangers, and frankly the persistence of this tradition is becoming something of an embarrassment to both academia and industry.

    • grahamburger 10 years ago

      While we're at it can we stop using animal or vehicle analogies to teach oop?

      • Alex3917 10 years ago

        This is a good point. Because you can't make a car or an animal out of software these analogies always seem to lead to bad teaching.

        Much better to use something like Person and Employee/Student, where it's easy to immediately grasp the value based on not having to duplicate the data fields you'd need for a basic CRM. (As opposed to having to make up ridiculous methods about the panda eating bamboo or whatever where no one understands what the fuck is going on.)

        • grahamburger 10 years ago

          Exactly! Ugh I hate that. "A cat can be an instance of animal, but it needs a 'meow' function" ... What?

          • stephengillie 10 years ago

            By oversimplifying, these examples actually obscure the lesson. It helped me to think of OOP objects as sub-variables, or even as a set of variables grouped by the first part of their name. Like a "multi-key/multi-value" hash table.

            The purpose of functions only started making sense after learning calculus and the replacement method, where a complex term was replaced by a single variable. This is where I learned they're mostly for readability, an adaptation to make programming easier for humans to do.

          • BatFastard 10 years ago

            Adding a "meow" function is the wrong way to go about it. The base class just needs a protected sound function so that each derived class can set the sound in its initialization routine. So many programmers, so few who truly understand OOP.

      • bobwaycott 10 years ago

        Out of curiosity, what are your go-tos for this?

        • grahamburger 10 years ago

          Well I'm not exactly a teacher or an expert, just an armchair critic - so I won't pretend that my ideas will be revolutionary or even all that good :) but, because this is something I've been thinking about recently, I'll contribute. My oldest son is 5 and I've been thinking about how I'll start to teach him programming, if he finds himself so inclined. Right now I'm thinking I'll start by working through a Christmas wish list program with him. For OOP specifically, the wish list items might make a good (if simplified) example of classes/objects, with maybe some inheritance for 'things I would like' vs 'things I would like to give to other people' vs 'things I would like to do' etc.

          Essentially my gripe with the animal and car analogies is exactly what Alex3917 wrote above - you're (almost?) never going to actually implement anything like a car on an animal in a real program. And if you do, you're almost certainly not going to give it methods like 'Honk' and 'Meow' (which is exactly how OOP was described in my first class on the subject.) It's not that they're bad analogies - in fact it's almost that they're too good of analogies. They represent the OOP concepts very well, just not the practical usage of the concepts.

          Actually the truth is I'm a little bit disillusioned with OOP altogether, and it seems like there's a lot of movement in the industry away from OOP with things like Go, Rust and other more purely functional languages.

          • TheOtherHobbes 10 years ago

            > never going to actually implement anything like a car on an animal in a real program.

            Did you mean "on" or "or"?

            Using OOP to implement a vehicle is a no-brainer. It's a completely standard model for games.

            Extending the animal class to make a car would be weird though.

            One point of OOP isn't that you make classes, but that the classes you make can be easily duplicated and automated.

            So you can make an animal with a few simple behaviours, use your animal prototype to make a herd or flock, and suddenly you've got emergent semi-intelligence, which you can define by changing a few lines in the prototype.

            It's not just a way of giving properties to something that's kind of like a real object - it's a way of simplifying automation and bulk updates of related entities.

            • qbrass 10 years ago

              >Extending the animal class to make a car would be weird though.

              Carriage extends Animal with Cart Car implements Carriage with Engine as Animal

          • invaliduser 10 years ago

            Actually, a language not having a class system does not mean it's not object-oriented. Javascript prior to ES6 did not have a class system, but was OO. Classes are just one of many ways to implement objects in a language (just saying, because you mention go & rust)

            • grahamburger 10 years ago

              Yeah for sure. I should have specified class based. Regardless, I think those languages place much less emphasis on OO than, say, Java or Ruby, right?

          • pbhjpbhj 10 years ago

            Lightbot and code.org are suitable from 5yo or earlier IMO. Code.org uses the "jigsaw" visual programming pane (blockly) that Scratch uses so they work well together - Scratch can export to flash for sharing online.

diimdeep 10 years ago

There is also ComputerCraft mod with Lua programmable blocks and visual code editor (ComputerCraftEdu) http://www.computercraft.info/ and http://computercraftedu.com/

markdavis33 10 years ago

Hey emeth...thanks for making this awesome project. As a father of 2 sons (aged 9 and 11, both Minecraft fanatics) this is a perfect platform to get them interested in coding. Starting with Python is a nice easy on-ramp for them, and they'll even start using GitHub with this project, which is great too. Keep up the cool work :)

asimuvPR 10 years ago

This is actually something I was looking for. Very nice! Do you mind adding a license to the work?

soared 10 years ago

Give me screenshots.

deepnet 10 years ago

Is there a good GPLed substitute for Minecraft ?

I am required to use a Free license as an educator and the massive appeal of voxels is undisputable.

justifier 10 years ago

A gateway to 3d rendering with scripts

once you've exhausted these lessons you can show them blender

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection