As soon as I detect with what we'll call a condition if I'm touching the edge I have to essentially spin around 180 degrees and then continue looping.
一旦我检测到这种情况,当我碰到边界时,我需要转180°然后继续这一循环过程。
I know this is a simple example, but when you mature as a programmer, one of the first things you should do when you sit down to tackle some problem is write something like this pseudo code.
我知道这是个很简单的例子,但是当你们成长为一名程序员后,当你们碰到问题后第一件事情就是,该写一些类似于,伪代码的东西。
I know, for a lot of you, it's like, OK, I got a heavy problem. Let's see, def Foobar open paren, a bunch of parameters.
我知道这对你们中的大多数人来说,应该没问题了,好,这儿我碰到了,一个严重的问题,我们看看,一堆参数。
应用推荐