Lecture 7 Notes

00 157 314 471 628 sinx 00 10 00 10 00 plot based

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: raw the black square Draw a black square with side 2.1 And center (0,0) s = 2.1; DrawRect(-s/2,-s/2,s,s,’k’) Insight Through Compu,ng Refinement Refinement R = 1; k = 1; Repeat while R >.1 Draw the k- th star Update R and k R = 1; k = 1; while R >.1 Draw the k- th star R = R/1.2; k= k+1; end Insight Through Compu,ng Draw the kth star if k is odd Magenta , radius R. center (0,0) otherwise Yellow, radius R, center (0,0) Insight Through Compu,ng 7 2/13/14 Refinement if rem(k,2)==1 DrawStar(0,0,R,’m’) else DrawStar(0,0,R,’y’) end Insight Through Compu,ng Solu,on R = 1; k = 1; while R >.1 if rem(k,2)==1 DrawStar(0,0,R,’m’) else DrawStar(0,0,R,’y’) end R = R/1.2; k= k+1; end Insight Through Compu,ng Numbers •  A number is a quan,ty •  Base 10, base 2, base B, are representa,...
View Full Document

This document was uploaded on 03/11/2014 for the course CSCI 004 at Brown.

Ask a homework question - tutors are online