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

 

 

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值