Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

[Phys-l] programming for kids



Hi --

Here are some half-baked thoughts, sort of a blog entry.

This is only tangentially related to physics, but certainly not totally
unrelated; see below for details.

I've recently been teaching programming to some kids in the range of 12
to 15 years old. You may be wondering what language system I decided
to use. Answer: Game Maker.
http://www.gamemaker.nl/

At first glance, Game Maker can be seen as a drag-and-drop programming
language, roughly akin to LabView. You create _objects_; the objects
are notified of _events_, and respond by performing _actions_.

The built-in features are rich enough to allow motivated kids to create
their own games from scratch ... not super-high-end games, but perfectly
reasonable games. Building a knockoff of Tetris, Space Invaders, Pacman,
or Breakout is straightforward.

The kids are totally amazed at how much they can accomplish.

At second glance, one discovers that the package includes a full-blown
programming language, GML (Game Maker Language), that looks a whole lot
like C++ (but without strong typing). This is the best thing I've ever
seen for allowing (and motivating) kids to learn about programming. The
typical situation is: There's something you can't easily do with the
drag-and-drop features, but can be done in a few lines of code. You
get tremendous bang-for-the-buck from those few lines.

Here's the reason I mention it in this forum: I often see connections between
computing and physics. A lot of computing sneaks into my physics ... and a
lot of physics sneaks into my computing. For example, the kids typically
don't get very far into their first game before they encounter a situation
that is best handled using vectors and dot products. Maybe that's not the
only way to handle the situation ... but you know me, you know I'm not
going to pass up the opportunity to teach about vectors and dot products.

In high-school math, it's kinda hard to get kids interested in dot products ...
unless/until they realize that they can use dot products in their games, e.g.
to make sure the ghosts are going the right direction while chasing after the
raptors....

Another physics connection is that you can easily implement cellular automaton
algorithms. (The gamemaker.nl site has a downloadable demo version of Conway's
game of life.) I haven't tried it, but I reckon this system would be pretty much
ideal for implementing things like the cellular relaxation-algorithm solution to
Laplace's equation (including multi-terminal capacitors) that I previously
implemented as a spreadsheet.
http://www.av8n.com/physics/laplace.html

Another physics connection arises if you try to program a "caroms" game. The
"bounce" action built in to the Game Maker system is nowhere near good enough.
So you need to write your own. This is interesting because (the way I do it,
anyway) the solution sits squarely in the middle of the Venn diagram where
math and physics intersect with programming. There are plenty of non-physics
considerations that come into play, including multiple issuances of the same
event and double-counting of events involving pairs ... but there are also
math/physics ideas that come into play, including center-of-mass motion vectors,
relative motion vectors, separation vectors, and Gram-Schmidt projection operators.
There are probably other ways of solving the problem, but the sophisticated
approach is at least as good as any other ... and it provides an opportunity
to teach about techniques that can be re-used in a thousand other applications.

This is also an opportunity to teach about random numbers. When I write games,
my tendency is to use random numbers by the truckload. (I was surprised by
how hard it was for the kids to get up to speed on random numbers; they didn't
even have a hook to hang the concept on. Has every notion of randomness been
removed from the K-8 curriculum when I wasn't looking?)

On the plus side, it always cracks me up to see kids learning to debug their
programs. Of course it's hard, but they do better at it than I would have
expected, considering the amount of detail and the level of abstraction involved.
A smart kid can run circles around most adults.

=============

Let's be clear: The Game Maker system is *not* ready for prime time. I am *not*
suggesting that you all rush out and do what I've been doing. For starters, the
Game Maker documentation is terrible. It is not even fully adequate for an expert
programmer to learn the system, and it is orders of magnitude away from being a
tutorial usable by beginners.

OTOH, a journey of 1000 miles begins with a single step ... and I reckon that
it would be worthwhile for some adventurous souls to experiment with the system
and _create_ the necessary tutorial material.

=============

There is a nice version of Game Maker that can be downloaded for free. For a few
bucks you can buy the "registered" version which has some additional features ...
but you should definitely start with the free version; you can always upgrade
later if you want.

It runs under Windows only. The latest version (6.1) demands a decent graphics card,
but if you have a lame graphics card you can download an older version (5.3) which
works just fine, and is much less demanding.

In some circles, calling something a "Game Maker game" is derogatory. That's
because there are a lot of very amateurish games floating around, created by
rank amateurs using Game Maker. But that does not discredit the system; indeed
I consider it a good thing that amateurs are attracted to the system. There are
plenty of systems in the world that are either Muggle-friendly or wizard-friendly
but *not both* ... but it doesn't have to be that way. What the world needs is
a system that is both Muggle-friendly and wizard-friendly ... and Game Maker
(imperfect as it is) comes far closer to that goal than anything I've ever seen.
It is quite possible to write high quality games in this system, and indeed there
are some such games floating around.

Some of my friends who are classically-trained programmers deeply detest
things like spreadsheeds and drag-and-drop languages ... and I understand
why the work they do (writing 100-million-line programs on which lives
depend) shouldn't be done by Muggles ... but there are lots of other things
that can be (and forsooth will be) done by Muggles, and it is important
to have languages that support that, too.