1-3.CheckerboardKarel.Hanouts.Programme Ethodology.Stanford Open Course.斯坦福開放課程-編程方法-作業1-3

 

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

 

 

下午自己改進了一下~~~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章