From 1451f1e7558ae84d000c29541ad2941b078ebe2f Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Wed, 27 Jul 2011 13:07:09 -0400 Subject: [PATCH] oops, forgot to add in the hello-bf example --- racketcon/Makefile | 4 - racketcon/bootstrap.gif | Bin 7406 -> 0 bytes racketcon/fact.html | 32 - racketcon/fact.rkt | 8 - racketcon/hello.rkt | 23 - racketcon/hello.xhtml | 41927 -------------------- racketcon/pacman.rkt | 450 - racketcon/pacman.xhtml | 56736 --------------------------- racketcon/plt-logo.png | Bin 6717 -> 0 bytes racketcon/racket-days-abstract.txt | 58 - racketcon/rain.rkt | 128 - racketcon/rain.xhtml | 43033 -------------------- racketcon/talk.rkt | 123 - tests/more-tests/hello-bf.rkt | 4 + 14 files changed, 4 insertions(+), 142522 deletions(-) delete mode 100644 racketcon/Makefile delete mode 100644 racketcon/bootstrap.gif delete mode 100644 racketcon/fact.html delete mode 100644 racketcon/fact.rkt delete mode 100644 racketcon/hello.rkt delete mode 100644 racketcon/hello.xhtml delete mode 100644 racketcon/pacman.rkt delete mode 100644 racketcon/pacman.xhtml delete mode 100644 racketcon/plt-logo.png delete mode 100644 racketcon/racket-days-abstract.txt delete mode 100644 racketcon/rain.rkt delete mode 100644 racketcon/rain.xhtml delete mode 100644 racketcon/talk.rkt create mode 100644 tests/more-tests/hello-bf.rkt diff --git a/racketcon/Makefile b/racketcon/Makefile deleted file mode 100644 index 79ab0c9..0000000 --- a/racketcon/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: - ../whalesong build talk.rkt - ../whalesong get-javascript --verbose fact.rkt > fact.js - ../whalesong get-runtime --verbose > runtime.js diff --git a/racketcon/bootstrap.gif b/racketcon/bootstrap.gif deleted file mode 100644 index fc5fc93b31ced2c54c8aa9e6f4cc64bd333399a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7406 zcmXY#^;?sT!^Q8|?gceq!06Epqd{tPNQ{_-0%J4+PH9CLjf9L81aSx|VN6uS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r0Ny-4; zk&VXFintjcFaB6wSdk0EPQ1D8zywl~ zV##HJj^LEW@vi%_YQh*;mhLq9tzvH9`@A%SDwzWDCJa8pHEUo`X$uE_J5#uoAnT03Ii@u8U_p%z2s8AG>Y8p!DK)EoRol#_?03!GrL8D+dEztvxP zZJ;bwk2J*3kk{z*yrSw$U_*G7>Tm$rLM)p!DY?znE?;EqJ@WqfwA7SbcI6jyB8tfH zTTmYx#x&aUlWOI>7-SzpIKNfD;;9onz*WBOTx9IbxLT2CH9N)n@ts^QG zWc>xmdR?=0=_9bdQ(V{0)x-}_&Q_kd4FwVeV?vDg_Z+xhoctpIA%+fGi%>}nRvA;Byw}WYP*N{tSLjzS$ogj7vB)y4GTp$h+bEqv zcnmi?fD2j53GDiA!N? zlWCx}`TYXlS^RRE^DUad#+H&n#fI(*in3vYo9Dbw4kKtEK}7a-pV!t(D=OA(07NaO zS{;tvl~@aa>t%-dr5QIuMpXx3@*Io`HVMhvYpZzq8!Y9;L$GAvzeyi<{V5K`9+{F_ lG=Jm#^Tz+metq2!$P804LBdM4Z(MB1u$RisT~q*Y`9Hj9(lY=6 diff --git a/racketcon/fact.html b/racketcon/fact.html deleted file mode 100644 index 9e9559f..0000000 --- a/racketcon/fact.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - -The factorial of 10000 is being computed. - - diff --git a/racketcon/fact.rkt b/racketcon/fact.rkt deleted file mode 100644 index fe8ef50..0000000 --- a/racketcon/fact.rkt +++ /dev/null @@ -1,8 +0,0 @@ -#lang planet dyoo/whalesong -(provide fact) -(define (fact x) - (cond - [(= x 0) - 1] - [else - (* x (fact (sub1 x)))])) diff --git a/racketcon/hello.rkt b/racketcon/hello.rkt deleted file mode 100644 index 24b4b5f..0000000 --- a/racketcon/hello.rkt +++ /dev/null @@ -1,23 +0,0 @@ -#lang planet dyoo/whalesong/bf - -+++++ +++++ initialize counter (cell #0) to 10 -[ use loop to set the next four cells to 70/100/30/10 - > +++++ ++ add 7 to cell #1 - > +++++ +++++ add 10 to cell #2 - > +++ add 3 to cell #3 - > + add 1 to cell #4 - <<<< - decrement counter (cell #0) -] -> ++ . print 'H' -> + . print 'e' -+++++ ++ . print 'l' -. print 'l' -+++ . print 'o' -> ++ . print ' ' -<< +++++ +++++ +++++ . print 'W' -> . print 'o' -+++ . print 'r' ------ - . print 'l' ------ --- . print 'd' -> + . print '!' -> . print '\n' diff --git a/racketcon/hello.xhtml b/racketcon/hello.xhtml deleted file mode 100644 index 2f8027b..0000000 --- a/racketcon/hello.xhtml +++ /dev/null @@ -1,41927 +0,0 @@ - - - - - Hello - - - - diff --git a/racketcon/pacman.rkt b/racketcon/pacman.rkt deleted file mode 100644 index b321aa0..0000000 --- a/racketcon/pacman.rkt +++ /dev/null @@ -1,450 +0,0 @@ -#lang planet dyoo/whalesong - -(require (planet dyoo/whalesong/world)) - - -;; Constants: - -(define E "empty") ;See CellValue data definition below -(define D "dot") ; -(define W "wall") ; - -(define INIT-BOARD ;See Board data definition below - (vector (vector W W W W W W W W W W W W W) - (vector W D D D D D D D D D D D W) - (vector W D W D W W W W W D W D W) - (vector W D W D W D D D W D W D W) - (vector W D W D D D W D D D W D W) - (vector W D W W D W W W D W W D W) - (vector W D D D D D E D D D D D W) - (vector W W W W W W W W W W W W W))) - -(define SMALL-BOARD - (vector (vector E E E) - (vector E E E))) - -(define CELL-SIZE 20) - -(define BOARD-WIDTH (* CELL-SIZE (vector-length (vector-ref INIT-BOARD 0)))) -(define BOARD-HEIGHT (* CELL-SIZE (vector-length INIT-BOARD))) - -(define SMALL-BOARD-WIDTH (* CELL-SIZE (vector-length (vector-ref SMALL-BOARD 0)))) -(define SMALL-BOARD-HEIGHT (* CELL-SIZE (vector-length SMALL-BOARD))) - -(define SCORE-HEIGHT 30) -(define SCORE-TEXT-SIZE 20) - -(define PM (circle 10 "solid" "yellow")) - -(define MTC (rectangle CELL-SIZE CELL-SIZE "solid" "black")) ; empty cell -(define DTC (overlay (circle 3 "solid" "white") MTC)) ; dot in cell -(define WALL (rectangle CELL-SIZE CELL-SIZE "solid" "blue")) ; wall - -(define MTB - (empty-scene BOARD-WIDTH - (+ BOARD-HEIGHT SCORE-HEIGHT))) - -(define SMALL-MTB - (empty-scene SMALL-BOARD-WIDTH - (+ SMALL-BOARD-HEIGHT SCORE-HEIGHT))) - - - -;; Data definitions: - - -;; Score is Natural -;; interp. dots eaten by pac-man since start of game - -(define INIT-SCORE 0) - -;; CellValue is one of: -;; - "empty" -;; - "dot" -;; - "wall" -;; interp. the content of a board cell - -;; Direction is one of: -;; - "U" -;; - "D" -;; - "L" -;; - "R" -;; interp. direction that a sprite is facing - -(define-struct sprite (x y dir)) -;; Sprite is (make-sprite Natural Natural Direction) -;; interp. the position in Board coordinates, and the direction of a sprite - -(define INIT-PM (make-sprite 6 6 "U")) - -;; Board is (vectorof (vectorof CellValue)) -;; interp. the game board - -(define RENDER-TEST-BOARD (vector (vector W E) - (vector D E))) - -(define-struct gs (pm board board-image score)) -;; GameState is (make-gs Sprite Board Image Score) -;; interp. all parts of the pac-man game; pac-man, the current -;; board, the current board image, and the current score - -(define MTB-GS (make-gs INIT-PM INIT-BOARD MTB INIT-SCORE)) - - -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;; Testing values: - -;; Sprite: -(define R-SPRITE (make-sprite 1 1 "R")) -(define L-SPRITE (make-sprite 1 1 "L")) -(define U-SPRITE (make-sprite 1 1 "U")) -(define D-SPRITE (make-sprite 1 1 "D")) - -;; Board: -(define EE-BOARD (vector (vector W W W W) - (vector W E E W) - (vector W W W W))) - -(define ED-BOARD (vector (vector W W W W) - (vector W E D W) - (vector W W W W))) - -(define DD-BOARD (vector (vector W W W W) - (vector W D D W) - (vector W W W W))) - -;; GameState: -;; MTB-GS previously defined above -(define END-GS (make-gs R-SPRITE EE-BOARD SMALL-MTB 0)) - - -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;; Functions: - - -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;; on-tick handler: - - -;; GameState -> GameState -;; advances the game - -(define (tick gs) - (local [(define pm (gs-pm gs)) - (define board (gs-board gs)) - (define board-image (gs-board-image gs)) - (define score (gs-score gs)) - (define new-pm (tick-pm pm board)) - (define new-board (tick-board board new-pm)) - (define new-board-image (tick-board-image board board-image new-pm)) - (define new-score (tick-score new-pm board score))] - (make-gs new-pm - new-board - new-board-image - new-score))) - -;; Sprite Board -> Sprite -;; updates pac-man's position based on its direction -(define (tick-pm pm bd) - (local [(define x (sprite-x pm)) - (define y (sprite-y pm)) - (define dir (sprite-dir pm))] - (make-sprite (checked-move-x x y dir bd) - (checked-move-y x y dir bd) - dir))) - -;; Natural Natural Direction Board -> Natural -;; moves x in direction dir, unless it runs into a wall on bd or dir is not in the x direction -;; ASSUMPTION: assumes x, y is at least one cell away from any edge of bd - -(define (checked-move-x x y dir bd) - (cond [(string=? "L" dir) (restrict-move (sub1 x) y x (sub1 x) bd)] - [(string=? "R" dir) (restrict-move (add1 x) y x (add1 x) bd)] - [else x])) - -;; Natural Natural Direction Board -> Natural -;; moves y in direction dir, unless it runs into a wall on bd or dir is not in the y direction -;; ASSUMPTION: assumes x, y is at least one cell away from any edge of bd - -(define (checked-move-y x y dir bd) - (cond [(string=? "U" dir) (restrict-move x (sub1 y) y (sub1 y) bd)] - [(string=? "D" dir) (restrict-move x (add1 y) y (add1 y) bd)] - [else y])) - -;; Natural Natural Natural Natural Board -> Natural -;; produces new-coord if bd does not contain a wall at check-x, check-y; otherwise produces old-coord - -(define (restrict-move check-x check-y old-coord new-coord bd) - (if (string=? (board-ref bd check-x check-y) "wall") - old-coord - new-coord)) - -;; Board Sprite -> Board -;; if cell at pacman's position is not empty, make a new board in which it is - -(define (tick-board bd pm) - (local [(define x (sprite-x pm)) - (define y (sprite-y pm))] - (if (string=? (board-ref bd x y) "empty") - bd - (new-board-w-empty-at x y bd)))) - -;; Number Number Board -> Board -;; produces a new board with an empty cell at x, y - -(define (new-board-w-empty-at x0 y0 bd) - (map-board (lambda (x y cv) - (if (and (= x0 x) (= y0 y)) - "empty" - cv)) - bd)) - -;; Board Image Sprite -> Image -;; updates the board image with an empty cell at x, y if pac-man is in a cell with a dot -(define (tick-board-image bd board-image pm) - (local [(define x (sprite-x pm)) - (define y (sprite-y pm))] - (if (string=? (board-ref bd x y) "dot") - (place-cell-image MTC x y board-image) - board-image))) - -;; Sprite Board Score -> Score -;; increases by 1 the score if pac-man is now in a cell containing a dot -(define (tick-score new-pm last-board score) - (local [(define x (sprite-x new-pm)) - (define y (sprite-y new-pm))] - (cond [(string=? (board-ref last-board x y) "dot") - (add1 score)] - [else score]))) - - -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;; on-key handler: - - -;; GameState KeyEvent -> GameState -;; updates pac-man's direction based on key -(define (key-handler gs key) - (make-gs (new-dir-pm (gs-pm gs) key) - (gs-board gs) - (gs-board-image gs) - (gs-score gs))) - -;; Sprite KeyEvent -> Sprite -;; produces pac-man facing in a new direction based on key -(define (new-dir-pm pm key) - (cond [(key=? "up" key) (make-sprite (sprite-x pm) (sprite-y pm) "U")] - [(key=? "down" key) (make-sprite (sprite-x pm) (sprite-y pm) "D")] - [(key=? "left" key) (make-sprite (sprite-x pm) (sprite-y pm) "L")] - [(key=? "right" key) (make-sprite (sprite-x pm) (sprite-y pm) "R")] - [else pm])) - - -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;; on-tilt handler: - - -;; ;; GameState Number Number Number -> GameState -;; ;; change pac-man's direction based on tilt -;; (define (tilt-handler gs yaw pitch roll) -;; (make-gs (tilt-pm (gs-pm gs) pitch roll) -;; (gs-board gs) -;; (gs-board-image gs) -;; (gs-score gs))) - -;; ;; Sprite Number Number -> Sprite -;; ;; changes pac-man's Direction based on pitch and roll -;; (define (tilt-pm pm pitch roll) -;; (make-sprite (sprite-x pm) -;; (sprite-y pm) -;; (tilt->dir (sprite-dir pm) pitch roll))) - -;; ;; Direction Number Number -> Direction -;; ;; changes Direction if there is a prominant tilt, otherwise produces old dir -;; (define (tilt->dir dir pitch roll) -;; (cond [(> (abs pitch) (abs roll)) -;; (if (positive? pitch) -;; "U" -;; "D")] -;; [(> (abs roll) (abs pitch)) -;; (if (positive? roll) -;; "R" -;; "L")] -;; [else dir])) - -;; (define (key-handler gs a-key) -;; (make-gs (key-pm pm a-key) -;; (gs-board gs) -;; (gs-board-image gs) -;; (gs-source gs))) - -;; (define (key-pm pm a-key) -;; (make-sprite (sprite-x pm) -;; (sprite-y pm) -;; (cond -;; [(key=? a-key "left") -;; "L"] -;; [(key=? a-key "right") -;; "R"] -;; [(key=? a-key "up") -;; "U"] -;; [(key=? a-key "down") -;; "D"] -;; [else -;; (sprite-dir pm)]))) - - - - - -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;; stop-when handler: - - -;; GameState -> Boolean -;; determines if pac-man has eaten all the dots -(define (game-over? gs) - (empty-board? (gs-board gs))) - -;; Board -> Boolean -;; determines if the board is empty -(define (empty-board? bd) - (foldr-board (lambda (x y cv b) - (and b (not (string=? cv "dot")))) - true - bd)) - - -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;; to-draw handler: - - -;; GameState -> Image -;; draws the game -(define (render gs) - (render-pm (gs-pm gs) - (render-score (gs-score gs) - (gs-board-image gs)))) - -;; Board -> Image -;; draws the board -(define (render-board bd) - (foldr-board (lambda (x y cv b) - (place-cell-image (cell-image cv) x y b)) - MTB - bd)) - -;; Sprite Image -> Image -;; adds pac-man image to img -(define (render-pm pm img) - (place-cell-image PM (sprite-x pm) (sprite-y pm) img)) - -;; Score Image -> Image -;; adds score to img -(define (render-score score img) - (local [(define score-text - (text (string-append "Score: " (number->string score)) SCORE-TEXT-SIZE "black"))] - (place-image score-text - (/ BOARD-WIDTH 2) - BOARD-HEIGHT - img))) - -;; CellValue -> Image -;; draws a board cell -(define (cell-image cv) - (cond [(string=? cv "empty") MTC] - [(string=? cv "dot") DTC] - [(string=? cv "wall") WALL])) - - -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;;------------------------------------------------------------------------------------- -;; Operations on Board and other helpers: - - -;; Board Natural Natural -> CellValue -;; looks up the value of a Board cell -(define (board-ref bd x y) - (vector-ref (vector-ref bd y) x)) - - -(define (build-vector n f) - (let ([vec (make-vector n)]) - (let loop ([i 0]) - (cond - [(< i n) - (vector-set! vec i (f i)) - (loop (add1 i))])) - vec)) - - -;; (Natural Natural CellValue -> CellValue) Board -> Board -;; the analogue of map for boards, the function is called for -;; each position in the board to produce a cell value for that -;; position in a new resulting board -(define (map-board fn bd) - (build-vector (vector-length bd) - (lambda (y) - (build-vector (vector-length (vector-ref bd y)) - (lambda (x) - (fn x y (board-ref bd x y))))))) - -;; (Natural Natural CellValue X -> X) X Board -> X -;; the analogue of foldr for boards, the function is called for -;; each position in the board to produce single value -(define (foldr-board fn base bd) - (local [(define nrows (vector-length bd)) - (define ncols (vector-length (vector-ref bd 0))) - - (define (rows y b) - (cond [(= y nrows) b] - [else - (rows (add1 y) - (cols 0 y b))])) - (define (cols x y b) - (cond [(= x ncols) b] - [else - (cols (add1 x) - y - (fn x y (board-ref bd x y) b))]))] - (rows 0 base))) - -;; Image Natural Natural Image -> Image -;; adds cell-img to board-image at x, y board coordinates -(define (place-cell-image cell-img x y board-image) - (place-image cell-img - (+ (* x CELL-SIZE) (/ CELL-SIZE 2)) - (+ (* y CELL-SIZE) (/ CELL-SIZE 2)) - board-image)) - - - - - -;; -> GameState -;; runs the game -(local [(define INIT-GS (make-gs INIT-PM - INIT-BOARD - (render-board INIT-BOARD) - INIT-SCORE))] - (big-bang INIT-GS - (on-tick tick 0.3) - (to-draw render) - (on-key key-handler) - ;;(on-tilt tilt-handler) - (stop-when game-over?))) diff --git a/racketcon/pacman.xhtml b/racketcon/pacman.xhtml deleted file mode 100644 index 4310bb9..0000000 --- a/racketcon/pacman.xhtml +++ /dev/null @@ -1,56736 +0,0 @@ - - - - - Pacman - - - - diff --git a/racketcon/plt-logo.png b/racketcon/plt-logo.png deleted file mode 100644 index 4e53f004449d1ff353cc84d4d795396ff4833acc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6717 zcmV-D8p7p?P)NL+ zaWMjy5-Y^UBIc57ld|Iwleo$_RAiS!g>vd%<6GB`bFY1c!NvwvFu1sYjD!H2H?|ZB zDS(7PS_y=Z_I+M6-JL(?%sD-Cdgh#!gsW0@e^p&Gr>CFa`OUX~{hRJNf~W|RMYp&f zrU}cjrPn0Nck|HG2Zd?i_JQo_?3A5SN;jX^erKmBc6Bj2K3+Upsf->y@4WHhC!bs= zg=i`>tg}^n<83wb#`9~UeX{k_TAo>;t+05*+i6r=^7XI(a$Zl5{%Ah0&vzVsb~ekY z#UlMfL%MhWe%-NamvFXk*Obc|PzWIr!k1dhBB)`c3=!Iya-$?9QBvaxekx->bwm_=Gp; zyIS|2zIFSR;_%_mI)~p|Q5ZVfn;9K}Y!>yA55t_f2+u?7plYR5El7k=NGZAdZpr%f zk^p2|2muGE;5e0cG8yl&Tu$C|)m1M){lEhc$P?YKb|r}-+R3L=e)9vZXPo-bL)SU4 zzWVw6zrXg;&RshZd-mWA4dDVVAZE{ob?eYqU4tb^KW@Cqf)NAZDx``4|@P5;h! zuFou5^fz6jqi1&R*+a(j$O2g)19gA_bayxUM?XTXT!|_cky7IOKAz{*k4pKBjd|RB zv&YVz9s#IcErcM4LD2v`q>&PtOm$0Fm-mk&BY(fqpbpz0Y{McRpEmwj0mgQ5Qlhok z*xP$izFhuhm+xOz(3(8Z1#|#80&oT3#9KCJ4*urNcncTe6^nSDN3~jw9397F(xKNwTbA=E^-*Kux&1TErD3|~7&1354B;{B%xaqF{c;(8%$xlE1w;h$r zt<$vb?f|-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9`3$2`a#Zv}}JFNZmu za7_k2<-oEG^o0LNV1}et+o&J}*mNG%97^wbutmbp6g=@-uwLdw%5hl{rlb{eOcn+m;3$wvh^o?h zTnq8O65@bTYPW=4KI|HXy$1ujjknj}23OUiT06M1k_2n5F$|?{J zX!`oRk)fgT?({_;$I`CJ<~gpuf1rb2N}VUF-c-N92UJIDJ+_aVw4Hep(ry_^0JX~B z%8!zi_V=PtzxN9Nlgp$q3cq47*^I}MHYrb%t75YC#M2+kQ}cl<*#Fny6D X -;; Picks a random element of elts. -(define (random-choice elts) - (list-ref elts (random (length elts)))) - - - -;; The world consists of all of the drops in the sky. -(define-struct world (sky ;; listof drop - )) - - - -(define (my-filter f l) - (cond - [(null? l) - '()] - [(f (car l)) - (cons (car l) - (my-filter f (cdr l)))] - [else - (my-filter f (cdr l))])) - - -;; tick: world -> world -(define (tick w) - (make-world - (my-filter not-on-floor? - (map drop-descend (cons (random-drop) - (cons (random-drop) - (world-sky w))))))) - - -;; drop-descend: drop -> drop -;; Makes the drops descend. -(define (drop-descend a-drop) - (cond - [(> (posn-y (drop-posn a-drop)) HEIGHT) - a-drop] - [else - (make-drop (posn-descend (drop-posn a-drop) (drop-velocity a-drop)) - (+ GRAVITY-FACTOR (drop-velocity a-drop)) - (drop-color a-drop) - (drop-size a-drop))])) - - -;; posn-descend: posn number -> posn -(define (posn-descend a-posn n) - (make-posn (posn-x a-posn) - (+ n (posn-y a-posn)))) - - -;; on-floor?: drop -> boolean -;; Produces true if the drop has fallen to the floor. -(define (on-floor? a-drop) - (> (posn-y (drop-posn a-drop)) - HEIGHT)) - -(define (not-on-floor? a-drop) (not (on-floor? a-drop))) - -;; make-drop-image: color number -> drop -;; Creates an image of the drop particle. -(define (make-drop-image color size) - (circle size "solid" color)) - - -;; place-drop: drop scene -> scene -(define (place-drop a-drop a-scene) - (place-image (make-drop-image (drop-color a-drop) - (drop-size a-drop)) - (posn-x (drop-posn a-drop)) - (posn-y (drop-posn a-drop)) - a-scene)) - - - -(define (my-foldl f acc lst) - (cond - [(null? lst) - acc] - [else - (my-foldl f - (f (car lst) acc) - (cdr lst))])) - - -;; draw: world -> scene -(define (draw w) - (my-foldl place-drop BACKGROUND (world-sky w))) - - - -(big-bang (make-world '()) - (to-draw draw) - (on-tick tick)) \ No newline at end of file diff --git a/racketcon/rain.xhtml b/racketcon/rain.xhtml deleted file mode 100644 index bb0a36d..0000000 --- a/racketcon/rain.xhtml +++ /dev/null @@ -1,43033 +0,0 @@ - - - - - Rain - - - - diff --git a/racketcon/talk.rkt b/racketcon/talk.rkt deleted file mode 100644 index 3ec8a1d..0000000 --- a/racketcon/talk.rkt +++ /dev/null @@ -1,123 +0,0 @@ -#lang planet dyoo/whalesong - -(require (planet dyoo/whalesong/js)) -(require (planet dyoo/whalesong/world)) - - -(define-struct world (index scaling rotate)) - -;; A slide is either a simple string or an image. - -(define font-size 50) - - - -(define slides - (list - (above - (text "Whalesong:" 100 "black") - (text "a Racket to JavaScript Compiler" 80 "black") - (square 20 "solid" "white") - (scale 2 (image-url "file:///home/dyoo/work/whalesong/racketcon/plt-logo.png")) - (square 20 "solid" "white") - (text "Danny Yoo (dyoo@hashcollision.org)" 50 "darkblue")) - (above (text "Why Whalesong?" font-size "black") - (square 20 "solid" "white") - (scale 2 (image-url "file:///home/dyoo/work/whalesong/racketcon/bootstrap.gif"))) - "World programs on the web" - (above (text "Reusing Racket's compiler..." font-size "black") - (square 20 "solid" "white") - (text "Hello world?" (floor (* font-size 2/3)) "black")) - "Web programs can use Racket too!" - "What's next?" - (text "http://hashcollision.org/whalesong" 80 "black"))) - - - - -(define (WIDTH) - (viewport-width)) - -(define (HEIGHT) - (viewport-height)) - -(define (BACKGROUND) - (empty-scene (WIDTH) (HEIGHT))) - - -(define (key w a-key) - (cond - [(key=? a-key "left") - (make-world (my-max (sub1 (world-index w)) 0) - (world-scaling w) - (world-rotate w))] - [(or (key=? a-key "right") (key=? a-key " ") (key=? a-key "enter")) - (make-world (my-min (add1 (world-index w)) - (sub1 (length slides))) - (world-scaling w) - (world-rotate w))] - - [(key=? a-key "up") - (make-world (world-index w) - (+ (world-scaling w) .1) - (world-rotate w))] - - [(key=? a-key "down") - (make-world (world-index w) - (- (world-scaling w) .1) - (world-rotate w))] - - [(key=? a-key "r") - (make-world 0 1 0)] - - [(key=? a-key "q") - (make-world (world-index w) - (world-scaling w) - (modulo (- (world-rotate w) 1) 360))] - - [(key=? a-key "w") - (make-world (world-index w) - (world-scaling w) - (modulo (+ (world-rotate w) 1) 360))] - - [else w])) - - -(define (draw w) - (rotate (world-rotate w) - (scale (world-scaling w) - (let ([a-slide (list-ref slides (world-index w))] - [bg (BACKGROUND)]) - (cond - [(string? a-slide) - (place-image (text a-slide font-size "black") - (quotient (image-width bg) 2) - (quotient (image-height bg) 2) - bg)] - - [(image? a-slide) - (place-image a-slide - (quotient (image-width bg) 2) - (quotient (image-height bg) 2) - bg)]))))) - -(define (tick w) - w) - - -(define (my-max x y) - (if (> x y) - x - y)) - -(define (my-min x y) - (if (< x y) - x - y)) - - - -(big-bang (make-world 0 1 0) - (on-key key) - (on-tick tick) - (to-draw draw)) diff --git a/tests/more-tests/hello-bf.rkt b/tests/more-tests/hello-bf.rkt new file mode 100644 index 0000000..4f6fc6d --- /dev/null +++ b/tests/more-tests/hello-bf.rkt @@ -0,0 +1,4 @@ +#lang planet dyoo/whalesong/bf ++++++ +++++ [ > +++++ ++ > +++++ +++++ > +++ > + <<<< - ] > ++ . > + +. +++++ ++ . . +++ . > ++ . << +++++ +++++ +++++ . > . +++ . +----- - . ----- --- . > + . > .