[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [school-discuss] first programming language



On Wed, Apr 9, 2008 at 12:45 AM, <knowtree@xxxxxxxxx> wrote:

As someone else wrote, kids love graphics. True, but what kids *really*
love are things that move and respond to inputs. The basic building blocks
of video games. It takes a lot of code to get anywhere near that with
Python (and Java, and C, ...), so much that the beginner cannot manage it.

Now look at Squeak.

That was me - I said that :-)

Can you give a small example of a squeak program? Here's an example of
a "cylon eye" (a red circle that moves back and forth) in Python (this is a
quick example, sans comments and pretty structure - hopefully the tabs don't
get sucked out by my email program):
----------

from pygame import display,draw
display.init()
window = display.set_mode((1024,100))
x = 512
y = 50
r = 40
v = 2
black = (0,0,0)
red = (255,0,0)
while True:
   window.fill(black)
   draw.circle(window,red,(x,y),r)
   x += v
   if x > 1024 or x < 0:
       v = -v
   display.update()

-----------

I think it would be interesting to see the equivalent of this program in some
of these other languages being mentioned.