69 lines
1.5 KiB
Racket
69 lines
1.5 KiB
Racket
#lang racket
|
|
(require slideshow)
|
|
|
|
(define (square n)
|
|
(filled-rectangle n n))
|
|
|
|
(define (zee w h)
|
|
(define bar
|
|
(filled-rectangle w h))
|
|
(define black-bar
|
|
(colorize bar "black"))
|
|
(define white-bar
|
|
(colorize bar "white"))
|
|
(define (iter n)
|
|
(if (<= n 1)
|
|
(vc-append black-bar white-bar )
|
|
(vc-append black-bar white-bar (iter (- n 1)))))
|
|
(iter 5))
|
|
|
|
;(define (chee sz)
|
|
; (define (hori a b n)
|
|
; (if (<= n 1)
|
|
; a (hc-append a [hori b a (- n 1)])))
|
|
; (define (vert a b n)
|
|
; (if (<= n 1)
|
|
; (hori a b n)
|
|
; (vc-append [hori a b n] [vert b a (- n 1)])))
|
|
; (vert
|
|
; (colorize (square 50) "white")
|
|
; (colorize (square 50) "black") sz))
|
|
|
|
|
|
(define (chee rows cols)
|
|
(define (draw-row a b n)
|
|
(if (<= n 1)
|
|
a (hc-append a [hori b a (- n 1)])))
|
|
(define (draw-board a b n)
|
|
(if (<= n 1)
|
|
(hori a b n)
|
|
(vc-append [hori a b n] [vert b a (- n 1)])))
|
|
(vert
|
|
(colorize (square 20) "white")
|
|
(colorize (square 20) "black") rows))
|
|
|
|
|
|
(define (add n m)
|
|
(if (equal? m 0)
|
|
m (+ n (add n (- m 1)))))
|
|
|
|
|
|
;(define (chee sz)
|
|
; (define white
|
|
; (colorize (square sz) "white"))
|
|
; (define black
|
|
; (colorize (square sz) "black"))
|
|
; (define white-black
|
|
; (hc-append white black))
|
|
; (define black-white
|
|
; (hc-append black white))
|
|
; (define row-white-black
|
|
; (define (iter n)
|
|
; (if (not (equal? n 0))
|
|
; (hc-append white-black (iter (- n 1)))))
|
|
; (iter sz))
|
|
; row-white-black)
|
|
|
|
|
|
; cc-superimpose
|