Who was also one of the word's first programmers. So she was trying to write this program, and it didn't work.
也是世界上最早的几个程序员之一,她正尝试着完成一个,复杂的求反正切的程序。
>> They only use that when the program that you're running-- the program that you're referring to is going to your computer?
>它只有在你运行程序的时候才用到-,那你刚刚提到的程序,会到你的电脑上运行吗?
By putting it in a function bug if I find a bug and I change my program I can just run the function again.
把我输入的值放到一个函数里,如果以后我在程序中发现了一个,并对程序进行更改的话,我可以直接。
So how do chess-playing programs, and particularly the best chess-playing programs, how do they work? Well, they play chess the same way you do.
那么,下棋程序,特别是最好的下棋程序,是如何工作的呢,它们的下棋方式同你们如出一辙
Is it some kind of procedure standard operating procedure that you follow?
是不是有一定的程序,标准的执行程序呢,然后你就按照那个程序?
The strategy then often is to figure out how, what sort of program can solve these problems and then we go on to ask, "How could this program be instantiated in the physical brain?"
心理学家们通常要先弄清,什么样的程序可以解决这些问题,然后我们会接着问到,"这个程序在我们的生理大脑中,是如何进行编译的"
So the moral here, again, is whenever you're doing an implementation of a simulation, you do need to have some underlying theory about the model.
所以这里的寓意还是,不管你在做什么东西的仿真程序,你需要有一个,模型的底层程序。
But it is a very handy way of thinking about, not just how to program, but how to break problems down into nice sized chunks.
但是它确实是一种很方便的思考方式,不仅仅限于编程序,在将程序分解为小部分时也很有用。
And it's hard to imagine a simpler program than this. So we very quickly realize that exhaustive testing is just never feasible for an interesting program.
更简单的程序了,因此我们很快的意识到,对一个程序来说详尽的,测试是永远不可行的。
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.
对于代码和程序你会有一种本能的讨厌,这是因为这些代码和程序看起来很丑陋,并且不容易维护。
There are absolutely going to be times where you're running a program where the programmer, say you, didn't possibly know in advanced how much RAM the program was going to need.
它们总是在,程序员运行程序的地方,你可能预先不知道那个程序,需要多少内存。
OK. Having done this now, I can simply go ahead and run this, and in fact if I go up here to run, you'll see I've got both an option to check the module, though in this case I'm just going to run it.
好,讲完了这些,我可以去执行程序了,实际上如果我在这里运行,你们会看到我同样得到了,一个可以同时检查模块的选项,虽然在这个例子中我就是直接去运行程序了。
Remember, it's not as though the people who designed the chess-playing programs can beat it.
记住,那些设计象棋程序的人,貌似也下不过他们的象棋程序
So really, once we start writing more interesting programs, you would have to type out long annoying commands like that to just compile more sophisticated programs.
实际上,一旦我们开始写一些更复杂的程序时,你们可能要键入那样一些长的,讨厌的命令,来编译跟高级的程序。
So today is about writing some programs and empowering you to write your own starting this coming week when Pset One goes out via the website tonight by 7:00 p.m.
今天我们将要写一些程序,并且让你们,在接下来的一周写你们自己的程序,今天晚上七点,习题集1会发布在网站上。
All right so it has to live in RAM as opposed to the hard drive because otherwise things would be terribly slow as you know so it's much better if your programs live while they're running in RAM and they end up in what's called the tech segment.
好的,它存在内存中,而不是硬盘中,因为,否则程序会非常的缓慢,程序在内存中运行会好得多,它们在技术段,的地方结束。
So an adversary who's actually trying to break your programs 'cause frankly too much software these days is not written with a paranoia in mind.
或者说是你的敌人,而且千方百计地要破坏你的程序,唉,这种漏洞百出的软件我见过的是在太多了。
So I wrote a little program called "chart" that, based on some data I happened to hardcode into the program, shows us their numbers for the past several years.
我写了一个叫做“图表“的小程序,基于我在程序中硬编码的一些数据,向我们显示在过去几年中我们课程的人数。
So, ask yourself frankly especially when it comes to designing your own tools and your own programs whether it's for real users to use, whether it's for your research group to use in some other field, you know, where do you even begin?
坦白讲,问一问你们自己,当你设计一个工具,一个程序时,它是否是为真实用户使用的,还是为在其他领域的,研究团队使用的,你们懂的,你从哪里开始?
This is me writing one hour of that episode of Pirandello and telling the other authors, here's what I'm assuming as you use it. So it's up to me to do it right, but if I do it, I'm going to specify, what does this function do?
作为一个程序员,我得为用户提供一些信息,这正是我写写的皮兰德娄戏剧的一小时片段,并且要告诉其它的作家,这是我希望你使用的地方,所以由我决定怎样去做好它?
I don't have to go read what it printed out in the screen. This has returned a value that I can use. Because I could do a test to say, is this a return value? If it's not, I'll do something else with it. So the binding is still there, it simply doesn't print it out.
我不想读到屏幕中打印出来的这行字,程序返回过一个我能够使用的值,因为我可以做个小测试,来说明这是否是返回的值,如果不是,我可以做一些其它的事,而这个绑定依然在这儿,没有打印任何东西。
We knew this was trying to do squaring, so intellectually we know we can square -4, it ought to be 16, but what happens here?
我们知道程序是用来求平方数的,那么按理说我们可以来求-4的平方,也就是16,但是程序结果是怎么样的呢?
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.
来运行程序的时候,错误就会出现缠住你了,因此现在我们真的要培养,在程序中有防卫性设计的概念。
Alright, so maybe a little underwhelming and we saw already what this program is going to do but let's just go through this process once before we start doing more interesting things and then we'll come back and at least give you a hint of what some of these syntactic details are doing.
好吧,这个程序也许太平庸了,让人印象不够深刻,我们也知道这个程序是干嘛的,在我们开始更有意思的事情之前,让我们再来讨论一下整个过程后再回来,这些语法细节到底是在做什么呢?,先给你们一点小小的提示。
And it probably, I think we can deduce, returns the right answer here.
然后程序也可能,我认为我们可以推断,程序会返回正确的答案。
So actually, let's just run it and then we'll talk about what it does.
那么,让我们运行下程序,然后来探讨下程序的功能吧。
So, an alternative to that that is incredibly common in just the programming world and in industry is to actually not write programs on your own personal computer but to actually write and run them on a server, someplace where the software is all standardized.
那么,在编程界和工业界普遍,使用的一个解决方案是,不在你自己的电脑上写程序,而是在服务器上编程运行,服务器上的软件都是标准化的。
The chess-playing program makes moves these guys haven't thought of.
象棋程序的走法,是这些程序员也未曾想到过的
- Now that's a slight lie-- or actually in these days of political debates, a slight misspeaking, a wonderful word-- -- it is technically correct. It is enough to allow us to write any program, but it's not enough to allow us to easily write any program.
现在还有点说谎的感觉,或者在这些强调政治辩论的日子中,可以说成是有些词不达意-,这是一个绝妙的形容词,在语义上是完全正确的,用这种语言我们可以编写任何程序,但是不能轻松地编写程序。
If what we mean is the mental, but that the aspect, the behavioral aspect of the mental, where even a chess-playing computer probably has it, then that's not a very compelling argument.
如果我们说的是精神的某个方面,即精神的表现面,是一个甚至连象棋程序都可能拥有的方面,那这就不是一个令人信服的论点
应用推荐