Wednesday, 7 November 2012

Recursion and Clock Project - Week of Nov 5th

Regarding the ongoing algorithm project, I have not had a chance to work out a formula for the sum of the areas of triangles that make up one of the pyramids; but I do hope to find some time this weekend.  I did notice today in class however that the algorithm I am searching for fits with the definition of recursion.  Given some n we can calculate the A, then if n-1 is not zero, then add the A' of the row with sides length n-1 to A, and so on until we come to n-n=0 and we stop.  I suppose if all else fails I could just use a conditional in DrRacket that takes n->V.

Having just finished the first project I feel much more confident in my DrRacket skills than ever before.  I did get stuck on the clarify-image definition for a while but thankfully Professor Heap sorted that out in class.  Before that I had tried to convert the image to a list, then map the function clarify-color to every element of the list, then convert this updated list back to and image.  I would have made it work too if it weren't for the width and height arguments needed to put the image back together properly.

I changed the hands of the clock for the project to three thin black rectangles (classy and understated in my opinion) but soon realized that half of the definitions that needed fixing were totally unnecessary if we weren't using an image in a box like the ones given.  So it was interesting to see how we could simplify the clock but I figured it would only lead to confusion if the new hands I had created weren't using the definitions that we were required to fix or write check-expects for, so I kept the original ones.

Theo

No comments:

Post a Comment