Computer Science Canada Visual DICE program |
Author: | iceman [ Mon Nov 12, 2007 6:39 am ] | ||
Post subject: | Visual DICE program | ||
Hi, I'd like to modify my simple dice program to display the correct BMP files to match the random seed. I'm not sure how to set up the array of pictures:
The pictures display fine. However, I'm have trouble modifying Pic.Draw (die2, x, 200, picMerge). I'm starting to think that a procedure is the best what to manage which of the 6 die appears..... |
Author: | Mazer [ Mon Nov 12, 2007 8:19 am ] |
Post subject: | RE:Visual DICE program |
I don't know what you're trying to say. You need to tell us more. How are you having trouble modifying that line? What exactly are you trying to do? |
Author: | iceman [ Tue Nov 13, 2007 7:16 am ] | ||
Post subject: | Re: Visual DICE program | ||
I want to use the random seed to determine which dice appear. I need to modify the following line : Pic.Draw (die1, x, 100, picMerge). For example, if the random seed for die # 1 is 5 then the die1 parameter of Pic.Draw() should be changed to die5. Initially, I thought that an array could manage the visual dice program but it appears that I need to use a procedure and pass the random seed values (ex. d1, d2) to the procedure to determine which pictures are displayed.
What do you think? |
Author: | Mazer [ Tue Nov 13, 2007 9:03 am ] | ||
Post subject: | RE:Visual DICE program | ||
First, you're using "random seed" incorrectly. The random seed is used by the random number generator to pick the next "random number" (it's not actually random, I won't get into details). By default, when your Turing program is started the generator will be seeded using the current system time so that no two runs of your program will turn out exactly the same (if using random numbers) unless they both begin at the same second. Finally, just make an array of pictures for the dice.
EDIT: And I'm not sure you understand how to use case. Read a tutorial on that. |