我正在寻找最酷的事情,你可以在几行简单的代码。我相信你可以用Haskell用15行写一个Mandelbrot集,但是很难理解。

我的目标是启发学生编程很酷。

我们知道编程很酷,因为你可以创造任何你想象到的东西——它是最终的创意出口。我想激励这些初学者,让他们尽可能多地克服早期学习的困难。

Now, my reasons are selfish. I'm teaching an Intro to Computing course to a group of 60 half-engineering, half business majors; all freshmen. They are the students who came from underprivileged High schools. From my past experience, the group is generally split as follows: a few rock-stars, some who try very hard and kind of get it, the few who try very hard and barely get it, and the few who don't care. I want to reach as many of these groups as effectively as I can. Here's an example of how I'd use a computer program to teach:

Here's an example of what I'm looking for: a 1-line VBS script to get your computer to talk to you: CreateObject("sapi.spvoice").Speak InputBox("Enter your text","Talk it") I could use this to demonstrate order of operations. I'd show the code, let them play with it, then explain that There's a lot going on in that line, but the computer can make sense of it, because it knows the rules. Then I'd show them something like this: 4(5*5) / 10 + 9(.25 + .75) And you can see that first I need to do is (5*5). Then I can multiply for 4. And now I've created the Object. Dividing by 10 is the same as calling Speak - I can't Speak before I have an object, and I can't divide before I have 100. Then on the other side I first create an InputBox with some instructions for how to display it. When I hit enter on the input box it evaluates or "returns" whatever I entered. (Hint: 'oooooo' makes a funny sound) So when I say Speak, the right side is what to Speak. And I get that from the InputBox. So when you do several things on a line, like: x = 14 + y; You need to be aware of the order of things. First we add 14 and y. Then we put the result (what it evaluates to, or returns) into x.

这就是我的目标,有一堆很酷的例子来演示,并在他们玩得开心的时候教他们。我在我室友身上尝试了这个例子,虽然我可能不会把它作为第一课,但她喜欢它,并学到了一些东西。

一些很酷的数学程序,可以做出漂亮的图形或容易理解的形状,这是很好的想法,我将研究这些。这里有一些复杂的actionscript示例,但这有点太高级了,我不能教flash。你还有什么其他的想法吗?


当前回答

10 PRINT "HELLO"
20 GOTO 10

但那时我还只是个孩子。这也是为什么它是最酷的事情。我不认为你能从第一次编写计算机程序中获得同样的快感。即使只是简单地向控制台无限地输出“HELLO”。

其他回答

这段PHP代码只能通过命令行在Mac上运行,但当每个人都想玩Twister时,它非常有用

$lr = array('left', 'right');
$hf = array('hand', 'foot');
$colour = array('red', 'yellow', 'blue', 'green');
while(true) {
    $a = $lr[array_rand($lr)];
    $b = $hf[array_rand($hf)];
    $c = $colour[array_rand($colour)];
    system("say $a $b $c");
    sleep(5);
}

在http://www.youtube.com/watch?v=a9xAKttWgP4上,你可以看到Conway的Game Of Life,它用大约5行APL(一种编程语言)编程(同时口头评论)。

它看起来很有趣,可以启发学生编程很酷,还有数学,数学,简洁的编程语言:)

顺便说一下,鲍勃·马丁叔叔在hanselminutes播客上提到了这个youtube视频。

摘自安德鲁·库克的《Malbolge: Hello World》

让他们在Malbolge试试这个:

(=<`$9]7<5YXz7wT.3,+O/o'K%$H"'~D|#z@b=`{^Lx8%$Xmrkpohm-kNi;gsedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543s+O<oLm

这是世界上最困难的编程语言“Hello World”,花了两年时间才找到:)

他们可以去Lou Scheffer的Malbolge页面:)

当然,你可以去看由饭泽久(Hisashi Iizawa)撰写的《世界上排名第一的99瓶啤酒计划》(这是一个ONE LINER!),这是酒井雅彦(Masahiko Sakai)关于Malbolge的pdf文件

Squeak是一个激发灵感的好工具

例如:http://squeakland.jp/school/drive_a_car/html/Drivecar12.html。

小书签怎么样?它将向他们展示如何操作他们每天使用的东西(互联网),而不需要任何开发工具。