On this page:
5.1 Image To Code Kata
5.2 House With Door Kata
5.3 House With Tree Kata

5 Day 5 – Making Complex Pictures

REVIEW Creating houses and trees

5.1 Image To Code Kata

read
Write the simplest code possible to make this shape:
image
(Note: This shape is 50 pixels wide and 43 pixels tall)
code
#lang racket
(require 2htdp/image)
 
(triangle 50 'outline 'purple)

5.2 House With Door Kata

read
Write code that produces an image of an aqua/blue house with a brown door.
code
#lang racket
(require 2htdp/image)
 
(above
  (triangle 100 'solid 'aqua)
  (overlay/align
   "middle"
   "bottom"
   (rectangle 30 50 'solid 'brown)
   (square 100 'solid 'blue)))

5.3 House With Tree Kata

read
Write code that produces an image of a aqua/blue house with a door, and a green/brown tree beside the house.
code
#lang racket
(require 2htdp/image)
 
(beside/align
  "bottom"
  (above
   (triangle 100 'solid 'aqua)
   (overlay/align
    "middle"
    "bottom"
    (rectangle 30 50 'solid 'brown)
    (square 100 'solid 'blue)))
  (above
   (circle 30 'solid 'green)
   (rectangle 20 80 'solid 'brown)))