I.G Semester Review G

Fall 2022, exam through Chapter 15 (conditionals), including gradients.

  1. (in-5-r?) Imagine drawing a circle centered at x=5 on the x-axis, with a radius given by an input. A point x on the number line is in that circle if x’s distance to 5 is less than or equal to the radius.

    Write a function in-5-r? that determines if a number x is within “radius” of the number 5 on the number line.

     ;; in-5-r? : number(radius) number(x) -> boolean`
     (define (in-5-r? radius x)
       false)
     (check-expect (in-5-r? 10 3) true) ;; 3 is within 10 of 5
     (check-expect (in-5-r? 7 20) false) ;; 20 is not within 7 of 5
     (check-expect (in-5-r? 1 2) false) ;; 2 is not within 1 of 5
    
  2. The circle is centered at (200,150) and has a radius of 50. The square is centered at (275,150) and has a side length of 100. The background is a gradient from light blue to light green. (These are technical color names in Racket.)

  3. Make an animation where a blue circle moves counterclockwise around a stationary square.

    • Rotates as time passes.
    • Moving the mouse causes the rotation clockwise (while the mouse is moving).
    • Hitting a key makes the circle jump to the 12:00 vertical position.
    • Outer radius of the circle that the blue circle revolves along is 200.

    More complex aspects:

    • There is a 15 pixel wide pink bar on the left that grows 30 pixels taller every time the circle in the animation completes a single revolution.
    • The background changes color from a dark gray (all components = 100) to a light gray (all components = 225), proportional to the number of degrees the blue circle has traveled.
    <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
      <iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/V5cQ9phZiWI?autoplay=0&controls=1&end=0&loop=0&mute=0&start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"
      ></iframe>
    </div>
    
Last modified August 18, 2023: 2022-2023 End State (7352e87)