Problem 3
In this exercise, your job is to get Karel to create a checkerboard pattern of beepers inside
an empty rectangular world, as illustrated in the following before-and-after diagram:
This problem has a nice decomposition structure along with some interesting algorithmic
issues. As you think about how you will solve the problem, you should make sure that
your solution works with checkerboards that are different in size from the standard 8x8
checkerboard shown in the example. Odd-sized checkerboards are tricky, and you should
make sure that your program generates the following pattern in a 5x3 world:
Another special case you need to consider is that of a world which is only one column
wide or one row high. The starter folder contains several sample worlds that test these
special cases, and you should make sure that your program works for each of them.
这个效果更好,高效率:http://blog.csdn.net/goodpress/archive/2011/01/29/6169122.aspx
下午自己改进了一下~~~