[plt-scheme] program online game

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Oct 13 21:21:09 EDT 2009

Shriram told me weeks ago that Moby was a drop-down menu in drscheme.  
-- Matthias



On Oct 13, 2009, at 8:45 PM, Danny Yoo wrote:

> On Tue, Oct 13, 2009 at 11:05 AM, Jay McCarthy  
> <jay.mccarthy at gmail.com> wrote:
>> I would try to do it in the world style and use the Javascript/Flash
>> compiler some are developing.
>>
>> Start here: http://world.cs.brown.edu/
>
>
> You may be able to use Moby; it's the BSL+world-to-Javascript compiler
> that Jay refers to.  You can start here:
>
>     http://github.com/dyoo/moby-scheme
>
> Moby takes a program written in BSL+World and translates them into a
> Javascript program that can run on your web browser.  As an example,
> you can look at the baduk-clock (igo Clock) example in:
>
>     http://github.com/dyoo/moby-scheme/blob/master/examples/baduk-clock.ss
>
> You can see a demo of the program running here:
>
>    http://hashcollision.org/baduk-clock/
>
> It's a game clock; note that it uses HTML input elements --- buttons
> --- as its main UI.  (If you're running with a fairly modern web
> browser, one of those buttons is styled using a CSS rotation
> transformation!)
>
> For the button with a picture, for example, something like this may  
> work:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> #lang moby
>
> ;; The world consists of a number.
>
> ;; We have two images, a plus and a minus image, that we'll plop onto
> our buttons.
> (define PLUS (js-img "http://boredzo.org/buttonicons/plus-8.png"))
> (define MINUS (js-img "http://boredzo.org/buttonicons/minus-8.png"))
>
> ;; plus-press: world -> world
> (define (plus-press w)
>  (add1 w))
>
> ;; minus-press: world -> world
> (define (minus-press w)
>  (sub1 w))
>
> ;; draw: world -> dom-sexp
> (define (draw w)
>  (list (js-div '((id "main")))
>        (list (js-text (format "World contains: ~a" w)))
>        (list (js-button plus-press)
>              (list PLUS))
>        (list (js-button minus-press)
>              (list MINUS))))
>
> ;; draw-css: world -> css-sexp
> ;; Let all text drawn in the main div have a font size of 30px.
> (define (draw-css w)
>  '(("main" ("font-size" "30px"))))
>
> (js-big-bang 0
>             (on-draw draw draw-css))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> Moby itself is still in very rough shape and under active development;
> I've got a sketch of documentation in:
>
>    http://github.com/dyoo/moby-scheme/blob/master/doc/moby-user- 
> api.txt
>
> which we're working to Scribble; hopefully we'll have something more
> reasonable in the very near future.
>
>
> But if Moby can make your Stratego program work on the web, I'd be
> thrilled.  Let me know if you have any questions!
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.