11-stepwise-refinement

11-stepwise-refinement - CS106A Handout #11 June 25, 2009...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Handout #11 CS106A June 25, 2009 An Example of Stepwise Refinement Thanks to Eric Roberts for basically this entire handout In our class example today, we’ll have Karel act out the coming of springtime to a winter world that looks something like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 In this sample world, the vertical wall sections represent barren tree trunks. In an attempt to add some semblance of life back to the world, Karel has taken on the mission of adorning the barren trees with a new set of leaves represented by beepers. Karel’s plan is to climb each of the trees and adorn the top of each tree with a cluster of four leaves arranged in a square like this: Thus, when Karel is done, the winter scene will look like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
– 2 – As in most Karel problems, the situation that Karel faces need not match exactly the one shown in the diagram. There may be more trees; Karel simply continues the process until there are no beepers left in the beeper bag. The trees may also be of different heights or
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

11-stepwise-refinement - CS106A Handout #11 June 25, 2009...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online