I wrote:
"to-play" MIGHT be a good way to do things, but in many cases (including the above "accelerate" example) it'll be more natural to specify a sound as you determine the new world, rather than as a separate function of the state of the world. It's analogous to the difference between "stop-when" and "stop-with". One could provide this ability very simply:

(define (play-with sound world)
     (begin (play sound) world))

On Oct 20, 2011, at 2:27 PM, John Clements replied:

Yes, but how do you write test cases for this?

Good question.  How do you write test cases for "play"?

At some point you inevitably move from returning values to outputting them somehow, and they become much more difficult to test. For text output, we can capture it to a string, but test cases for sound may need to be human-checked.


It occurs to me that a few months ago, when I was porting one of my colleagues' students' "game programming" final project to Racket, I used the "play-sound" function from racket/gui/base in a world program. It worked, but I wasn't trying to do anything complicated with it.



Stephen Bloch
sbl...@adelphi.edu



_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to