links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Today's Discovery
Last updated at 2:20 pm UTC on 16 January 2006
Today's Discovery: 09 July '01

I have been trying to cut and paste the buildButton method from SameGame to MyStuff Trailblazer. However, every time I try to save, I get unknown variable messages (color, for example). When I changed the superclass name from Object to AlignmentMorph, suddenly color was no longer an unknown variable.

In Squeak, many classes are already made for us. That is why Squeak OO programming truly features re-usable code. I understand this a little better now.

My challenge now is to select appropriate superclasses. I need to learn what classes are available and what they do! :)

Today's Discovery: 02 August '01

I have been trying to figure out a way to simulate the random value (sum) that would be generated from simultaneously throwing three six-sided dice. The probabilities of a given sum (e.g., 3, 4, 5,..17, 18) differ and to calculate these probabilities (and then have an object that picks random values according to these probabilites) requires complicated math. What I realized while reading Mark's book was that if I create a single six-sided die object, then I could use other objects to request values from the six-sided die object and sum the results (e.g., If I wanted to simulate 3 six-sided dice, I could have an object make 3 requests for a value from the die object. Then, this new object could sum the three values and automatically I would be given a value between 3 and 18 and with the same probabilities as simultaneously throwing 3 dice). This does not tell me the probability of a given value, but it does provide me with the value (adhering to the corresponding probabilities), and that is all that I am after. This involves no probabilities math and is also very reusable.

Or just try
((1 to: 3) collect: [:e | 6 atRandom]) sum