15. Warmups A

  1. Write a function pick-pic : Number -> Image that uses a number 1, 2, or 3 to select a picture of a water balloon, a deck of cards, or a car.

  2. Modify your function so that putting any other number produces a picture of a mouse.

  3. Write a function cshape: String -> Image that uses words “triangle”, “rectangle”, and “circle” to select a picture of a red triangle, a blue rectangle, or a green circle.

  4. Modify your function so that entering any other string gives an outline black circle.

  5. Write proximity: number number -> string.

    • If the first number is within 10 of the second number, then put out “neighbors”.
    • If the first number is within 20 of the second number, then put out “close”.
    • Otherwise put out “far”.
  6. Write a random-bw function that takes in a width and a height, and produces an image with every pixel either black or white, randomly chosen.

Last modified August 18, 2023: 2022-2023 End State (7352e87)