Created
September 13, 2018 08:23
-
-
Save astynax/c9cab8060a7b3461c9b41e2d6911b9aa to your computer and use it in GitHub Desktop.
Generated picture "Dots"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require 2htdp/image) | |
(define (dot flag s) | |
(underlay (square s 'solid (if flag 'white 'black)) | |
(circle (/ s 2) 'solid 'gray) | |
(circle (/ s 4) 'solid (if flag 'black 'white)))) | |
(define (sq2x2 flag i1 i2) | |
(if flag (sq2x2 #f i2 i1) | |
(above (beside i1 i2) | |
(beside i2 i1)))) | |
(define (step flag s) | |
(let ((i (dot flag s))) | |
(if (< s 10) | |
(underlay (square (* 2 s) 'solid (if flag 'white 'black)) i) | |
(sq2x2 flag i (step (not flag) (/ s 2)))))) | |
(sq2x2 #t (step #t 160) (step #f 160)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment