;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-advanced-reader.ss" "lang")((modname scheme_art) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #t #t none #f ()))) ;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Chainmail ;;; ;;; Description: ;;; ...coded scheme like you... ;;; took an error in the knee. ;;; This will protect you. (define (draw) (define height 20) ;final height of the pyramid (define (inout dir) ;shift between inside and outside rings (forward (* 3 dir)) (left 90) (forward (* 3 dir)) (right 90)) (define (hex inside count) ;draw a hexagon with proper openings (pendown) (if (= count 6) (penup) (begin (forward (- 19 (* 2 inside))) (penup) (forward 6) (pendown) (forward (- 7 (* 2 inside))) (left 60) (hex inside (+ count 1))))) (define (ring) (hex 0 0) (inout 1) (hex 1 0) (inout -1)) (define (row length) ;draw a row of linked rings (if (= length 0) nil (begin (ring) (forward 50) (row (- length 1))))) (define (draw-rows count) ;draw rows of linked rings, forming ;a pyramid with specified height (if (> count height) nil (begin (row count) (backward (* 50 (+ count 1))) (left 60) (backward 50) (right 60) (draw-rows (+ count 1))))) (draw-rows 0) ;start the count at zero (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. All Scheme tokens in this file (including the one below) count ; toward the token limit. (draw)