LOGO 海龟作画 系列 一 之 给孩子最好的编程启蒙语言 - Logo Turtle Graphics - Series 1 - Best Introductory Programming for Kids

in #cn7 years ago (edited)

I think the LOGO turtle graphic is the best introductory programming language for the kids. LOGO has ranked 49 according to the TIOBE (August, 2017)

The turtle can be controlled by simple commands such as forward, backward, left, right. Then as the turtle moves, it draw a line.

The LOGO also supports high level programming concepts (such as condition if, repeat loop). Modern LOGO even supports/implements the fourth generation Object Oriented concepts.

There are many LOGO interpreters online, for example, http://www.calormen.com/jslogo/ is written in JS.

I have also written a PHP Online Interpreter in 2006 (11 years ago). The source code is at: https://github.com/DoctorLai/PHPLogoInterpreter/

我上幼儿园的时候,父母把我送到一个“科技”夏令营,那个时候我第一次接触真正的电脑(之前都是玩小霸王学习机)。也就是那个时候,我学习第一门编程语言,LOGO 海龟作图。

LOGO语言很简单,对孩子来说很好学,孩子也挺感兴趣的,因为这门语言最重要就是操作一只海龟,然后控制海龟在屏幕上走动,走动的过程海龟会留下痕迹,也就是相当于在屏幕上画线。

比如最基本的4个指令:

  • 前进 FT (或者 Forward)
  • 后退 BK(或者 Backward)
  • 左转 LT (或者 Left)
  • 右转 RT(或者 Right)

海龟默认起始位置是 屏幕中心 朝向北。比如,在LOGO控制台里敲入 FT 100 那么海龟前进了100步

在输入 RT 90 FD 100 则告诉海龟 向右转90度 再前进100步

然后 任何时候输入 HOME 则会让海龟回到屏幕中心 头朝向北

循环

很多时候我们要重复一些指令(让海龟重复走)比如画个等边三角形,就可以分解成,重复3次这个动作:【前进100步,并向右转120度】

这时候可以用这个命令 REPEAT 3 [FD 100 RT 120]

画个四边形 REPEAT 4 [FD 100 RT 90]

画个五边形 REPEAT 5 [FD 100 RT 72]

然后你大概可以得出 画 N 边形就是

REPEAT N [FD 100 RT 360/N]

比如画个 30边形,我们把步长调小一点,调成 10 步,这下感觉像个圆了。

海龟作图陪伴我度过了童年,它很简单,很直观,我想孩子会很感兴趣的(大概6-7岁我觉得就可以开始启蒙一下孩子)。

LOGO语言还支持 橡皮擦,条件判断,递归 等第三代编程语言(面向过程)概念,甚至最新版本的还支持 第四代面向对象的程序设计,真是很强大。

根据 TIOBE 每月编程排名榜,2017年8月份,LOGO还排第49名,说明还是有很多孩子在使用(主要是在学校里的教育)。

好玩么?之后我会再继续这个系列。。这里有一个用JS写的LOGO解释器,在这里:http://www.calormen.com/jslogo/

对了,11年前,我用PHP写了一个服务端的LOGO解释器。源代码在:https://github.com/DoctorLai/PHPLogoInterpreter

Originally published at https://steemit.com Thank you for reading my post, feel free to Follow, Upvote, Reply, ReSteem (repost) @justyy which motivates me to create more quality posts.

原创 https://Steemit.com 首发。感谢阅读,如有可能,欢迎Follow, Upvote, Reply, ReSteem (repost) @justyy 激励我创作更多更好的内容。

// 稍后同步到我的中文博客和英文计算机博客

近期热贴 Recent Popular Posts

Sort:  

我会支持你,上帝保佑你,我学中文,所以如果我犯了一些错误,那么我道歉并保留
非常感谢你
smilies-1732509__340.jpg

Wow ... you are a programmer, i am the last few years also learned php, but not as good as you, a progammer will always be sought by job,

And I see the program penyumu http://www.calormen.com/jslogo/, what should I write and then I run ?, I write left, then I run why do not want to walk?

What should i write for the road?

try left 90 fd 100

好玩!

生个小孩一起玩。

我看行

那今天晚上你就不要玩STEEM了, 好好准备造人吧。😀

我要先减肥呢,现在太胖啦

Coin Marketplace

STEEM 0.20
TRX 0.14
JST 0.030
BTC 66543.69
ETH 3327.31
USDT 1.00
SBD 2.71