[BULK] Re: [plt-scheme] scaling and rotating images using image.ss

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Sat Sep 26 15:34:22 EDT 2009

Yaron Minsky wrote:

> how do you guys think about randomness?  I've found that adding a  
> bit of randomness can make games considerably more compelling.  But  
> it's not clear how to include randomness in a reasonably simple way  
> that doesn't compromise on the purely-functional nature of the  
> callbacks...

> I'll be very interested in reading the approach to testability.   
> I'm also curious about how one effectively tests the rendering  
> functions --- it's really not obvious to me what if anything one  
> can do there.

My textbook introduces animations in chapter 6, and randomness in  
chapter 8 (motivated, naturally, by animations).  Randomness comes up  
again and again after that, turning deterministic animations into fun  
video games.

As Matthias said, there are two non-exclusive ways to manage testing  
of random functions:
1) test whether the result is one of the acceptable results (using  
extensions to check-expect that will be Coming Soon)
2) break the function into a call to "random" and a function that  
does deterministic processing on the random number.  The latter can  
be tested as usual, and the former is so simple that it shouldn't  
need much testing: the only thing that can go wrong is passing the  
wrong argument to "random".

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.