[racket-dev] multiple key-press

2010-07-22 Thread Shriram Krishnamurthi
I just spoke with a room of high-school students studying Universe
programming in a summer course at Brown.

One major complaint was that they couldn't do multi-key-presses.  For
instance, they want to use WASD navigation combined with a right-side
key for firing, and want to be able to fire and navigate at the same
time.

They've been using Shift, but the general consensus amongst the kids
was this was Not Cool.  Basically, they felt like they were being
cheated out of building a real game.

I don't know what it would take to support this.

Shriram
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] multiple key-press

2010-07-22 Thread Jay McCarthy
As far as I know, at the lowest level there is no multiple key press
event even in the OS.

If they want to do that, they should change their world to record the
current key press state:

(define-struct the-world (keys . everything-else))

and at the start of `on-tick' look at the collective impact of all the
keys, resetting it to 'empty' when the new world is returned.

That's more like how actually game engines work anyways.

Jay

On Thu, Jul 22, 2010 at 7:25 AM, Shriram Krishnamurthi s...@cs.brown.edu 
wrote:
 I just spoke with a room of high-school students studying Universe
 programming in a summer course at Brown.

 One major complaint was that they couldn't do multi-key-presses.  For
 instance, they want to use WASD navigation combined with a right-side
 key for firing, and want to be able to fire and navigate at the same
 time.

 They've been using Shift, but the general consensus amongst the kids
 was this was Not Cool.  Basically, they felt like they were being
 cheated out of building a real game.

 I don't know what it would take to support this.

 Shriram
 _
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev




-- 
Jay McCarthy j...@cs.byu.edu
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

The glory of God is Intelligence - DC 93
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] multiple key-press

2010-07-22 Thread Matthias Felleisen

I have considered this issue. I decided that these kinds of kids should be 
introduced to Universe programs as opposed to World programs. That's way cooler 
than silly one-keyboard games. 



-- Matthias





On Jul 22, 2010, at 9:29 AM, Jay McCarthy wrote:

 As far as I know, at the lowest level there is no multiple key press
 event even in the OS.
 
 If they want to do that, they should change their world to record the
 current key press state:
 
 (define-struct the-world (keys . everything-else))
 
 and at the start of `on-tick' look at the collective impact of all the
 keys, resetting it to 'empty' when the new world is returned.
 
 That's more like how actually game engines work anyways.
 
 Jay
 
 On Thu, Jul 22, 2010 at 7:25 AM, Shriram Krishnamurthi s...@cs.brown.edu 
 wrote:
 I just spoke with a room of high-school students studying Universe
 programming in a summer course at Brown.
 
 One major complaint was that they couldn't do multi-key-presses.  For
 instance, they want to use WASD navigation combined with a right-side
 key for firing, and want to be able to fire and navigate at the same
 time.
 
 They've been using Shift, but the general consensus amongst the kids
 was this was Not Cool.  Basically, they felt like they were being
 cheated out of building a real game.
 
 I don't know what it would take to support this.
 
 Shriram
 _
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev
 
 
 
 
 -- 
 Jay McCarthy j...@cs.byu.edu
 Assistant Professor / Brigham Young University
 http://teammccarthy.org/jay
 
 The glory of God is Intelligence - DC 93
 _
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] multiple key-press

2010-07-22 Thread Shriram Krishnamurthi
 As far as I know, at the lowest level there is no multiple key press
 event even in the OS.

Yes, that's why I had scare-quotes in my message.

 If they want to do that, they should change their world to record the
 current key press state:

I told them that.  But the problem is that inversion of control makes
the world structure and its logic *significantly* uglier.

 I have considered this issue. I decided that these kinds of kids
 should be introduced to Universe programs as opposed to World
 programs. That's way cooler than silly one-keyboard games.

Doom is silly?  Duke Nukem 3D is silly?

Perhaps you do indeed know a great deal about games.  But perhaps you
have a more limited understanding of your audience.

Shriram
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] multiple key-press

2010-07-22 Thread Matthias Felleisen

On Jul 22, 2010, at 9:38 AM, Shriram Krishnamurthi wrote:

 
 I have considered this issue. I decided that these kinds of kids
 should be introduced to Universe programs as opposed to World
 programs. That's way cooler than silly one-keyboard games.
 
 Doom is silly?  Duke Nukem 3D is silly?
 
 Perhaps you do indeed know a great deal about games.  But perhaps you
 have a more limited understanding of your audience.

This issue came up at NEU at some point, and when we showed the kids Universe 
in response, they though it was way cooler to run the multi-player game on many 
computers than on a single keyboard. (I don't know whether they implemented 
it.) 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] multiple key-press

2010-07-22 Thread Jay McCarthy
On Thu, Jul 22, 2010 at 7:38 AM, Shriram Krishnamurthi s...@cs.brown.edu 
wrote:
 As far as I know, at the lowest level there is no multiple key press
 event even in the OS.

 Yes, that's why I had scare-quotes in my message.

 If they want to do that, they should change their world to record the
 current key press state:

 I told them that.  But the problem is that inversion of control makes
 the world structure and its logic *significantly* uglier.

We could change world/universe to automatically do this batching of
key presses and have an interaction-rate similar to the tick-rate.
I'm not sure THAT would be much better, but it would be less tedious,
etc.

Jay


 I have considered this issue. I decided that these kinds of kids
 should be introduced to Universe programs as opposed to World
 programs. That's way cooler than silly one-keyboard games.

 Doom is silly?  Duke Nukem 3D is silly?

 Perhaps you do indeed know a great deal about games.  But perhaps you
 have a more limited understanding of your audience.

 Shriram




-- 
Jay McCarthy j...@cs.byu.edu
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

The glory of God is Intelligence - DC 93
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] [plt] Push #20751: master branch updated

2010-07-22 Thread Jay McCarthy
This commit finishes adding 'define-datatype' and 'match' to ASL per
Shriram's request.

I'd like comments and improvements on a few things:

1) The documentation -- most of the ASL docs are very vague,
presumably because the book covers it, but in this case that's not
true

2) The subset of match supported

3) The way I've prevented escaping to the larger part of ASL.

Jay

On Thu, Jul 22, 2010 at 3:40 PM,  j...@racket-lang.org wrote:
 jay has updated `master' from 9eb053d4db to 407dcee206.
  http://git.racket-lang.org/plt/9eb053d4db..407dcee206

 =[ 2 Commits ]==

 Directory summary:
  45.5% collects/lang/private/
  15.2% collects/scribblings/htdp-langs/
  38.1% collects/tests/racket/

 ~~

 eeada45 Jay McCarthy j...@racket-lang.org 2010-07-22 15:12
 :
 | Fixing error string
 :
  M collects/lang/private/teachprims.rkt |    2 +-

 ~~

 407dcee Jay McCarthy j...@racket-lang.org 2010-07-22 15:39
 :
 | Adding match to ASL
 :
  M collects/lang/htdp-advanced.rkt                |    1 +
  M collects/lang/posn.rkt                         |    1 +
  M collects/lang/private/teach.rkt                |  133 -
  M collects/scribblings/htdp-langs/advanced.scrbl |   48 +++-
  M collects/tests/racket/advanced.rktl            |   96 +++
  M collects/tests/racket/bega-adv.rktl            |   10 --
  M collects/tests/racket/beg-adv.rktl             |    7 -

 =[ Overall Diff ]===

 collects/lang/htdp-advanced.rkt
 ~~~
 --- OLD/collects/lang/htdp-advanced.rkt
 +++ NEW/collects/lang/htdp-advanced.rkt
 @@ -48,6 +48,7 @@
             [advanced-when when]
             [advanced-unless unless]
             [advanced-case case]
 +            [advanced-match match]
             [advanced-delay delay]
             [advanced-module-begin #%module-begin]
             )

 collects/lang/posn.rkt
 ~~
 --- OLD/collects/lang/posn.rkt
 +++ NEW/collects/lang/posn.rkt
 @@ -4,6 +4,7 @@

  ;; The posn struct for the teaching languages
  (provide struct:posn make-posn posn? posn-x posn-y set-posn-x! set-posn-y!
 +         (rename-out (posn posn-id))
         (rename-out (posn-signature posn)))

  (struct posn (x y) #:mutable #:transparent)

 collects/lang/private/teach.rkt
 ~~~
 --- OLD/collects/lang/private/teach.rkt
 +++ NEW/collects/lang/private/teach.rkt
 @@ -49,7 +49,10 @@
           (rename deinprogramm/quickcheck/quickcheck quickcheck:property 
 property)
           test-engine/scheme-tests
           scheme/class
 -          (only lang/private/teachprims beginner-equal? beginner-equal~?))
 +           ../posn.rkt
 +          (only lang/private/teachprims
 +                 beginner-equal? beginner-equal~?
 +                 advanced-cons advanced-list*))
   (require-for-syntax teachhelp.ss
                       teach-shared.ss
                      syntax/kerncase
 @@ -209,6 +212,7 @@
                              advanced-begin
                              advanced-begin0
                              advanced-case
 +                              advanced-match
                              advanced-shared
                              advanced-delay)

 @@ -2520,6 +2524,133 @@
                (with-syntax ([clauses clauses])
                  (syntax/loc stx (case v-expr . clauses)]
           [_else (bad-use-error 'case stx)]
 +
 +    ;; match (advanced)
 +    (define (advanced-match/proc stx)
 +      (ensure-expression
 +       stx
 +       (lambda ()
 +        (syntax-case stx ()
 +          [(_)
 +           (teach-syntax-error
 +            'match
 +            stx
 +            #f
 +            expected an expression after `match', but nothing's there)]
 +          [(_ expr)
 +           (teach-syntax-error
 +            'match
 +            stx
 +            #f
 +            expected a pattern--answer clause after the expression 
 following `match', but nothing's there)]
 +          [(_ v-expr clause ...)
 +           (let ([clauses (syntax-list (syntax (clause ...)))])
 +             (for-each
 +              (lambda (clause)
 +                (syntax-case clause ()
 +                  [(pattern answer ...)
 +                   (let ([pattern (syntax pattern)]
 +                         [answers (syntax-list (syntax (answer ...)))])
 +                     (check-single-expression 'match
 +                                              for the answer in a `match' 
 clause
 +                                              clause
 +                                              answers
 +                                              null))]
 +                  [()
 +                   (teach-syntax-error
 +                    'match
 +                    stx
 +                    clause
 +                    expected a pattern--answer clause, but found an empty 
 clause)]
 +                  

Re: [racket-dev] multiple key-press

2010-07-22 Thread YC
On Thu, Jul 22, 2010 at 6:43 AM, Jay McCarthy jay.mccar...@gmail.comwrote:

 On Thu, Jul 22, 2010 at 7:38 AM, Shriram Krishnamurthi s...@cs.brown.edu
 wrote:
  As far as I know, at the lowest level there is no multiple key press
  event even in the OS.
 


Not that there is a multiple key press event in OS, but below are some
potential solutions/examples in other languages:

Here's a potential solution in C# describing looking up keyboard states via
kernel32.dll - not sure whether it will easily be applicable/ported in your
scenario.

http://stackoverflow.com/questions/2686019/multiple-key-presses-doing-different-events-in-c

Processing also appear to handle multiple keypress (code):

http://wiki.processing.org/index.php?title=Keep_track_of_multiple_key_presses

Here's one demo in flash with WASD - but did not show firing:

http://www.freeactionscript.com/2009/02/multiple-key-press-detection/

Cheers,
yc
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] Can't Find a Workaround for Bug 11017 in DrRacket

2010-07-22 Thread Matthew Flatt
At Wed, 21 Jul 2010 17:09:03 -0600, Matthew Flatt wrote:
 I've pushed a change to the git repo that I don't think will fix the
 problem, but I think it will give us better information when you get a
 chance to try it.

The new error message provoked a bug report that led to a repair. So,
please try the latest and let me know if the problem is fixed.

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] Getting old versions of PLT Scheme

2010-07-22 Thread Carl Eastlund
To fix a backwards compatibility bug, I just had to go download PLT
Scheme 4.2.4.  It's a real pain to do so.  First, the Racket site
doesn't seem to link to versions before 5.0.  I had to go to
plt-scheme.org manually.  It'd be nice if I could get to the whole
history in one place.  Second, at plt-scheme.org, the window is
covered by a misshapen dialog telling me to go to the Racket site.  I
have put a picture of the misshapen window up at
http://www.ccs.neu.edu/home/cce/racket-dialog.png (this from Firefox
3.6.2 on Intel Mac).  Third, it takes several clicks to get to the
4.2.4 download, and at each click the dialog pops back up again.  Our
site(s) would be easier to get around if any or all of these were
fixed: old versions from the Racket Download page, an easier to read
redirection dialog, and only seeing that dialog once per visit.

Carl Eastlund
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev