Scratch So, we looked last week at Scratch, very briefly, but hopefully you found if you've dived in already that the interface is fairly intuitive and it really just allows you to implement ideas that you conjure up in your mind.
我们上周非常简略地提到了,不过我希望你们热切的投入了进去了,那个界面是相当直观的,相信我,这真的可以让你实现你,大脑中的构想。
Alright, so we can implement any number of algorithms using this thing because the basic mechanism I have here is a comparator.
好了,利用它我们可以实现,很多种算法,因为在此我用到的基本原理是一个比较器。
And I would be able to simply bury away the details of how those other instances are created from how I want to use them by simply calling methods on the classes.
也就是一些线段的组合,我还可以把怎么实现那些,实例的细节包装起来,把它和调用实例分开来,我们下次还会接着讲这个。
And we can do that with the electrode array that I previously showed you.
我们可以利用此前我讲到的电极列阵,来实现。
What Hicks said--this is the coffee hour conversation at The London School of Economics he said, it's right now 1925 but if you want to invest or borrow in 1926 I can do it for you.
希克斯在伦敦政经学院的那次,咖啡时间中谈到,现在是1925年,但如果你想在1926年投资或贷款,我可以帮你实现
Suppose I take a number. I'd like to add up all the digits inside of the number.
我可以用到刚刚提到的工具,来实现这个功能。
And yeah, I know it comes built in, that's OK, what we want to do is use it as an example to look at it.
对,我知道这个方法可以通过内置的算法,来实现,这没关系,我们只是,把它当做一个例子来讲解。
All right. If you flip to the second side of your handout, you'll see that I have a piece of code there, that does this-- let me, ah, I didn't want to do that, let me back up slightly- this is the algorithm called search.
你可以看到实现这个功能的代码,让我,额,我不想这么做,让我们回来一点,这就是命名为search的算法-,我们来看看这个算法吧。
So pictorially, it's as though there's now some other part of the blackboard here, maybe way up here where I can put anything I want that's accessible to main, that's accessible to swap, that's accessible to increment or any other function I might implement because it is, in fact, global.
绘画般地,它是在这里黑板上的其他部分,可能在这里的上面,我在哪里可以放置这些东西,使它们可以被main函数使用,可以被swap函数使用,可以被increment函数使用,或者我所实现的其它函数,因为它实际上是一个全局变量。
应用推荐