这是第三关。这关的主要目的是让小朋友在前一关的基础上可以明白命令是可以引起事物状态的变化的。
命令是什么?就是让角色做一个动作。
小朋友可以把自己当成里面的角色,你说跳,他就跳,你说走,他就走。这样子就能理解了。
我们可以看到角色的目标不仅是有宝石。还要进行两次左转。还要变化开关的状态。
我们让小朋友在用前两关学习到知识和方式,口述出来角色每一步的动作命令。
还可以让小朋友给角色起个名字。
这一关出现的新命令就是“切换开关”。我们能发现它跟之前的命令是不同。它被我们执行之后,开关的状态就变化了。我们就可以知道命令是可以引起变化的了。
我们把代码写下面:
moveForward()
moveForward()
turnLeft()
moveForward()
collectGem()
moveForward()
turnLeft()
moveForward()
moveForward()
toggleSwitch()
通过这三关的学习和研究,我们的小朋友可以体会到面向过程的编程思路了。可能她们还不能明白什么叫面向过程的含义。但没有关系,这一关已经完全可以入门了。
传送门:
MacOS Playgrounds学习 学习编程一 前记--https://www.jianshu.com/p/a0de277374a4
MacOS Playgrounds 学习编程一 第一关 发出命令--https://www.jianshu.com/p/3c85397f1eae
MacOS Playgrounds 学习编程一 第二关 添加新命令--https://www.jianshu.com/p/4efa5c18dc50
MacOS Playgrounds 学习编程一 第三关 切换开关--https://www.jianshu.com/p/00556d6430bf
MacOS Playgrounds 学习编程一 第四关 传送门练习--https://www.jianshu.com/p/47bd57d0193f
MacOS Playgrounds 学习编程一 第五关 发现并修复程序错误--https://www.jianshu.com/p/5bc9200edbbe
MacOS Playgrounds 学习编程一 第六关 消灭程序错误练习--https://www.jianshu.com/p/f19bd2955ed8
MacOS Playgrounds 学习编程一 第七关 最短路线--https://www.jianshu.com/p/1ef210253be5
MacOS Playgrounds 学习编程一 第八关 组合新行为--https://www.jianshu.com/p/f548b1fd3134
MacOS Playgrounds 学习编程一 第九关 创建新函数--https://www.jianshu.com/p/22ab39aaea97
MacOS Playgrounds 学习编程一 第十关 收集、切换、重复--https://www.jianshu.com/p/e43d60f98bc7
MacOS Playgrounds 学习编程一 第十二关 嵌套模式--https://www.jianshu.com/p/645f6716217c
MacOS Playgrounds 学习编程一 第十三关 嵌入式阶梯--https://www.jianshu.com/p/d87f9662601d
MacOS Playgrounds 学习编程一 第十四关 寻宝--https://www.jianshu.com/p/18c73154e46b
MacOS Playgrounds 学习编程一 第十五关 使用循环--https://www.jianshu.com/p/f7c0866930ec
MacOS Playgrounds 学习编程一 第十六关 循环每一侧--https://www.jianshu.com/p/94d75e9d5eab
MacOS Playgrounds 学习编程一 第十七关 行至边缘再返回--https://www.jianshu.com/p/cc7e8095bb9a
MacOS Playgrounds 学习编程一 第十八关 循环跳跃者--https://www.jianshu.com/p/99618bef896e
MacOS Playgrounds 学习编程一 第十九关 拓展技能--https://www.jianshu.com/p/a20810b11d6d
MacOS Playgrounds 学习编程一 第二十关 宝石农场--https://www.jianshu.com/p/8c3808d1a646
MacOS Playgrounds 学习编程一 第二十一关 席卷四处--https://www.jianshu.com/p/cc7f6a1c34e7
MacOS Playgrounds 学习编程一 第二十二关 检查开关--https://www.jianshu.com/p/e34fb0431b6e
MacOS Playgrounds 学习编程一 第二十三关 使用 else if--https://www.jianshu.com/p/6414ef7692e2
MacOS Playgrounds 学习编程一 第二十四关 循环条件代码--https://www.jianshu.com/p/a657e47b851d
MacOS Playgrounds 学习编程一 第二十五关 满足条件时向上爬--https://www.jianshu.com/p/4a69a1c3435f
MacOS Playgrounds 学习编程一 第二十六关 定义更巧妙的函数--https://www.jianshu.com/p/d61e03e095ae
MacOS Playgrounds 学习编程一 第二十七关 围困其中--https://www.jianshu.com/p/88442c7ce61b
MacOS Playgrounds 学习编程一 第二十八关 决策树--https://www.jianshu.com/p/0843bd9ae286
MacOS Playgrounds 学习编程一 第二十九关 使用“非”运算符--https://www.jianshu.com/p/be8fa74b6c46
MacOS Playgrounds 学习编程一 第三十关 非之螺旋--https://www.jianshu.com/p/f42905cbaed1
MacOS Playgrounds 学习编程一 第三十一关 检查这个与那个--https://www.jianshu.com/p/67b1c6e16b6a
MacOS Playgrounds 学习编程一 第三十二关 检查这个或那个--https://www.jianshu.com/p/d94a67728a93
MacOS Playgrounds 学习编程一 第三十三关 逻辑迷宫--https://www.jianshu.com/p/62bbc0ce2490
MacOS Playgrounds 学习编程一 第三十四关 当……时运行代码--https://www.jianshu.com/p/9aa41733c6d0
MacOS Playgrounds 学习编程一 第三十五关 创建更巧妙的while循环--https://www.jianshu.com/p/3fdfb33a443f
MacOS Playgrounds 学习编程一 第三十六关 正确选取工具--https://www.jianshu.com/p/e5ed25be735e
MacOS Playgrounds 学习编程一 第三十七关 四乘以四--https://www.jianshu.com/p/81ed2e6009d4
MacOS Playgrounds 学习编程一 第三十八关 转身--https://www.jianshu.com/p/a3c9bae7d6a2
MacOS Playgrounds 学习编程一 第三十九关 富饶之地--https://www.jianshu.com/p/077743cdfcdd
MacOS Playgrounds 学习编程一 第四十关 套嵌循环--https://www.jianshu.com/p/d8670c9e7962
MacOS Playgrounds 学习编程一 第四十一关 随机矩形--https://www.jianshu.com/p/61b916f61e37
MacOS Playgrounds 学习编程一 第四十二关 始终右转--https://www.jianshu.com/p/b7cf92fbfcaa
MacOS Playgrounds 学习编程一 第四十三关 右手定则--https://www.jianshu.com/p/9ccd20151c96
MacOS Playgrounds 学习编程一 第四十四关 调整算法--https://www.jianshu.com/p/10c2a0de990d
MacOS Playgrounds 学习编程一 第四十五关 征服迷宫--https://www.jianshu.com/p/b4d731fe3639
MacOS Playgrounds 学习编程一 第四十六关 左转还是右转--https://www.jianshu.com/p/cd7fa32316e5
MacOS Playgrounds 学习编程一 第四十七关 向左走,向右走--https://www.jianshu.com/p/b9b1dc9c8f2e
MacOS Playgrounds学习 学习编程一 小结后记--https://www.jianshu.com/p/8ad6485e447a