PG: Generic editing: Beta doesn't have a consistent name. Sometimes Betty, sometimes Jasmine. General comment: I don't feel like we've settled on a goal and really crafted a sequence to reach it. I think we're showing off all sorts of things that can be done with recursion, rather than thinking about how to /teach/ recursion and structuring this so that the student really becomes the master. This page: I basically like this, but I feel it is less focused on helping a kid write a recursive reporter than on the mathematics. Morgan's solution and the first four lines of the TOL are clever but, for our purposes, irrelevant. Worse, if we want to build a power of 2 block, we should teach how to do /that/ recursively. The method here (last two lines of TOL) does, sort of, do that, but because the focus is elsewhere (and we never draw it back), it is likely to be special purpose. We don't see the right abstraction, Morgan's "one less than a power of 2."
BH to sort out this feedback from Tim Matthies : Post2 --MF, 6/17/20
Mary to consider: Post1
In this lab, you will develop recursive reporters.
On this page, you will explore a procedure for counting the segments in a fractal tree, and re-build it recursively.
In Unit 7, you built recursive trees. Each tree is made up of line segments.
level | segment count |
---|---|
1 | 1 |
2 | 3 |
3 | |
4 | |
5 | |
6 |
for
loop to build the power of 2, then I subtracted 1 at the end:report
block sends the final value. I put the last math operation there.tree
.tree
. We used recursion. We built a segment, turned, called tree
to build a smaller tree, turned again, and then called tree
again to build another, smaller tree.segments in tree
reporter recursively. But we can ignore all the moving and turning parts, right? Let me give this a shot. You've built and worked with recursive command blocks. Recursion can also be used in reporters.
PG: Drastic change, based on whatever we do with "counting branches" (not trees—there's only one tree), this should change. The reporter is so special-purpose, whereas a n^m block is both /less/ complex (more straightforward) and /more/ generally useful, e.g., for counting the triangle's children.
Here's Jasmine's code for the segments in tree
function:
report
block only connects to the blocks above it. That's because report
returns the result of its input slot, immediately, as the output of the segments in tree
reporter block. No further code is executed in a reporter after a report
block.tree
command had two recursive calls, but this code has only one. Why?triangle fractal
block. Build a block that reports the total number of triangles formed in a level n triangle fractal: