;; The first three lines of this file were inserted by DrScheme. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname |scheme lab 2|) (read-case-sensitive #t) (teachpacks ((lib "image.ss" "teachpack" "htdp"))) (htdp-settings #8(#t constructor repeating-decimal #f #t none #f ((lib "image.ss" "teachpack" "htdp"))))) ;Amber Truhanovitch and Neil Cheney ;Problem 1 ;boat (define abox (rectangle 100 100 'outline 'black)) (define boatbase (rectangle 80 10 'solid 'red)) (define sail1 (triangle 27 'solid 'green)) (define sail2 (rectangle 40 20 'solid 'green)) (define water (rectangle 100 10 'solid 'blue)) (define mass ( rectangle 10 70 'solid 'brown)) (define water-base (overlay/xy (overlay/xy abox 0 40 boatbase) 0 50 water)) (define water-base-mass (overlay/xy water-base 10 0 mass)) (define w-b-m-s (overlay/xy water-base-mass 10 -40 sail1)) (define w-b-m-s-s (overlay/xy w-b-m-s 10 0 sail2)) ;w-b-m-s-s ;car (define box (rectangle 100 100 'outline 'black)) (define street (rectangle 100 20 'solid 'black)) (define carbase (rectangle 50 20 'solid 'red)) (define wheel1 (circle 9 'solid 'purple)) (define car-image (overlay/xy (overlay/xy (overlay/xy (overlay/xy box 0 40 street) 0 20 carbase) 20 30 wheel1 ) -20 30 wheel1 )) ;car-image ;Problem 2 ;contract: side-by-side-image image image -> image ;purpose: given two seperate images create a side-by-side-image so that first image immediately to the left of the second image. To switch which picture is first, the only change needed is the first x value from negative to positive. ; example: (side-by-side-image w-b-m-s-s car-image) should produce the sailboat image to the left of the car image. ; (side-by-side-image w-b-m-s-s car-image) should produce the of the car image to the left of the sail boat image. (define (side-by-side-image image1 image2) (overlay/xy image1(+ (/ (image-width image1) 2) (/ (image-width image2) 2)) 0 image2)) ;trial cases: (side-by-side-image w-b-m-s-s car-image) "should produce" the sailboat image to the left of the car image. ; (side-by-side-image w-b-m-s-s car-image) "should produce" the of the car image to the left of the sail boat image. ;(side-by-side-image w-b-m-s-s car-image) ;Problem 3 ;contract: stack-image image image -> image ;purpose: given two separate images create a stacked-image so that the first image immediately to the left of the second image. To switch which picture is first, the only change needed is the first x value from negative to positive. ; example: (stacked-image w-b-m-s-s car-image) should produce the sailboat image above the car image. ; (stacked-image car-image w-b-m-s-s) should produce the the car image above the sailboat image. (define (stacked-image image1 image2) (overlay/xy image1 0 (+ (/ (image-height image1) 2) (/ (image-height image2) 2)) image2)) ;trial cases: (stacked-image w-b-m-s-s car-image) "should produce" the sailboat image above the car image. ; (stacked-image car-image w-b-m-s-s) "should produce" the the car image above the sailboat image. ;(stacked-image w-b-m-s-s car-image) ;Problem 4 ;contract: counterchange image image -> image ;purpose: given two seperate images create a a "counterchange", which is the images taht return a 2X2 arangment of them. by uncomenting the side-by-side-image-reverse. ;example: (counterchange (define counterchange (overlay/xy side-by-side-image -100 100 side-by-side-image-reverse)) ;counterchange ;Problem 5 ;contract: checkerboard image image -> image ;purpose: to create two colors and build a counterchange image of red and blue colors. ;example: