What are the basic modules, what information needs to be passed between those modules in order to make the code work.
基本的模块是哪些,为了让整个程序正常运行,这些模块之间需要传递的信息有哪些。
I guess, like, there're certain things like in the meetings that are secret, like the ritual or whatever,
我想有一些事情是秘密的,例如会议程序什么的,
And so now, you have two threads so to speak, two miniature programs, two sprites all interacting with one another.
现在我们有两个线程,两个轻量型程序,两个精灵在沟通。
bug It's not true now. If there is a bug in the program it's there for only one reason.
如果程序中有一个,那一定是有原因的,是你通过例如犯了。
It looks as though the natural thing to say about the chess-playing computer is, it does have beliefs. It does have desires.
这看起来好像是一件自然的事情,说象棋程序,有自己的信念 有欲望
As we went from a company with $300 million to $3 billion to $60 billion, we had to put processes in place, for sure, to deal with the complexity of what we were trying to accomplish.
我们公司的资产由3亿美元,增加到30亿,600亿,所以我们应该有套程序,来处理这么复杂的情况,实现我们的目标。
If you're wondering what's OK or what's not OK, it's very clearly written out in this handout, so make sure you read through it, because it is your responsibility to make sure that your calculator does not have anything extra programmed in it.
如果你不清楚什么可以什么不可以,讲义上写得很清楚,所以请大家务必看完它,因为你有义务保证,在自己的计算器里,没有编上额外的程序。
If you have a computer that plays chess and you want to explain how the computer plays chess, it's impossible to do so without talking about the programs and mechanisms inside the computer.
如果你有一台能下国际象棋的计算机,你想要解释计算机是如何下国际象棋的,如果你不谈程序以及计算机的内部结构,那你就不能对它如何下国际象棋,给出解释。
After all, I'm going to try and build a simulation of the stock market, so I might as well have the notion of a market, and probably the notion of a stock.
不管怎样,我得建立一个股票市场的仿真程序,所以我最好要有股票的概念,和股市的概念。
Turns out this user's manual, just like a typical book, has multiple sections or chapters and Chapter One is generally about programs.
结果这个用户手册,就像一个特定名册,有好多章节,第一章大概是关于程序的。
And for the next, off and on for the next couple of weeks, we'll be talking about Python and program organization.
接下来大概有几周时间,我们将要讨论Pyton语言和程序结构。
Well, there's a chunk of memory called the heap that you can grab as much memory as you want so long as it exists for your program.
好的,这里有一块叫做堆的内存,这样你就可以获得你想要那么多的内存,因为它为你的程序而存在。
Right, so an exception then has this format that I can control as a programmer.
好的,所以一个异常会有这样的格式,我能把他当做一个程序员来控制。
- So now we have three conditions -- three forks in the road -- and this program is in fact correct, at least hopefully.
现在我们有三个条件--三岔路口-,然后这个程序的确是正确的,至少我希望是。
It's a bad habit to get into, because when you come back to it, it may haunt you later on down the road. So really get into that notion of trying to be defensive as you program.
来运行程序的时候,错误就会出现缠住你了,因此现在我们真的要培养,在程序中有防卫性设计的概念。
And that does two things: bug one, it helps catch bugs in your code, and secondly it often converts it into a more efficient sequence of instructions before you actually go off and run it. All right?
这有两点好处:,第一是可以帮助你发现程序中的,第二是把你的代码,在运行之前,转换为更有效率的指令的集合,对不对?
Whenever I think about how to build an interesting program, and I hope whenever you think about it, the first thing I think about is, what are the classes I might want to have, what are the types?
无论我何时,去想怎样建立一个有趣的程序,你们每次做这种思考的时候,你们想得第一件事,就是我应该要有什么类呢,它们是什么类型的呢?
On my computer at home I've got a program that allows my computer to play chess.
在我家里的电脑里有一个,玩国际象棋的程序
There's the name of the program including the dot slash.
这里有程序的名字,包括。
But in fact warranted confidence in our programs.
实际上我们的程序中有保证的自信。
Any questions on this copy program?
对于这个拷贝程序有什么问题么?
But very soon will you find that if you're writing programs with lots and lots of functions, and some might call these, and these might call these, you can come up very soon with scenarios where you can not order them top to bottom, because everything is comingled, and there's a lot of cross talk among all of your functions.
但是不久后你们会发现你们写的程序中,有很多很多的函数,有的函数调用这些函数,这些函数又调用另外的函数,你不能用脚本,把它们从上到下排序,因为所有函数相互混合,在你的函数中也有很多交叉。
I guess it's not macho enough, John, to just, you know, you know, go off and do things by hand, you ought to just run them, but it's a valuable tool to get into, so let me do that here.
我认为这不太男人了,John,你知道的,他们仅仅是认为比起用手做来,更应该直接去运行程序,但是这确实是调试代码的非常有价值的工具,让我在这里给大家演示下吧。
Yes. The point is, it's not going to work, and she caught both of them, impressive, it's not going to work because iters left is already negative, it's just going to skip the whole loop, and I'm in trouble, so thank you for catching that.
是的,重点是,程序不会运行的,她发现了两个错误,很令人敬佩,程序不会运行,因为iters,left已经是负数了,它会跳过整个循环,然后就有麻烦了,谢谢你提出这个问题。
So it's got an internal procedure,internal function, local to the unit test, that runs the simulation.
它有内部过程,内部函数,它对unit,test来说是有本地环境,来支持股票仿真程序的运行。
You should acquire overtime this instinctive aversion to just code or programs that just look ugly because things that look ugly generally are not easy to maintain.
对于代码和程序你会有一种本能的讨厌,这是因为这些代码和程序看起来很丑陋,并且不容易维护。
This is on purpose, because one of the things I hope you have learned to do this semester, is look up things you don't know, and figure out what they do. What they mean.
我举这个程序是有目的的,因为我希望你们这续期能学到,如何去查找你不知道的东西并,且弄懂它,们是干什么的,是什么意思。
Programs that can produce music that have-- that we recognize as music, that have melodic structure and develop themes, resolve, music that nobody's heard before.
这些程序可以生成,我们认可的音乐,这些音乐具有旋律形态和递进的主题,有转为和音的章节,而且从未有人听到过这些音乐
And there's a few things going on here, so clearly there is multiple sprite, multiple characters, and recall from last week that each sprite has its own set of strips or programs.
我们可以看到许多东西,譬如,很明显我们可以看到有许多小精灵,许多字符,想想上周,每个精灵还自有一套,程序。
应用推荐