|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| MWForum Message | [Date Index] [Threads] [Authors] [Attachments] [Subscribe] | ||||||||
I am resending the following because it might seem mysterious to =anyone who has not followed the previous interchanges about the problem. What I wrote is addressed to someone I think called Damian who posed a problem that you will find at the bottom of this message. ----------------- More comments on the dice roll problem that might give you something to think about: Taken literally Susan's solution is a correct solution to a different problem than the one I thought you were posing. I thought you wanted the procedure to tell you how many rolls actually happened up to the time a complete set was achieved. But the great thing about programming is that this does not make her solution "wrong." Even if it does not quite do what (I think) you wanted, it still has a good idea in it, which you can adapt to solve the problem that you wanted to solve. But you have to add another idea as well: in some way you must count the number of rolls that have been done up to the time the thing stops. I won't deprive you of the fun of doing this yourself. Seymour P.S. You might find it interesting to accompany me through the following thought steps that came after I wrote the above: First thought: I can't remember whether STOPALL exists in LogoWriter or whether it came in with MicroWorlds. If not Damian would get into a bit of trouble. So0 I wondered how he could get out of it. Second thought: Always ask: what would be the simplest way out of the trouble? Third step: What would happen if he just removed STOPALL from Susan's suggested procedure? Fourth: Interesting guess---- even if STOPALL does exist in LogoWriter, the procedure it would print the same with or without the STOPALL .instruction.. but what would be happening inside the computer would be different ! (I don't have LogoWriter near where I am and so I haven't tried this /// I'm just guessing ..or thinking .. or whatever you call it. I hope someone tries this and discusses what happened) Worth pondering. P.P.S. Since I have gone on about this longer than I meant to I think I should take the trouble to make quite clear how i interpreted Damian and Susan: I read Susan as suggesting that Damian's diceroll procedure be changed to to diceroll :n prep repeat :n [dice if (and :one > 0 :two > 0 :three > 0 :four > 0 :five > 0 :six > 0) [pr (se [After ] :n [ rolls I have a complete set] )] ] end to dice make "roll random 6 if :roll = 0 [make "one :one + 1] if :roll = 1 [make "two :two + 1] if :roll = 2 [make "three :three + 1] if :roll = 3 [make "four :four + 1] if :roll = 4 [make "five :five + 1] if :roll = 5 [make "six :six + 1] end to prep make "one 0 make "two 0 make "three 0 make "four 0 make "five 0 make "six 0 end Try it with a few inputs like diceroll 100, diceroll 50, diceroll 3 in two forms -- one as it stands, the other after removing the stopall. Susan Einhorn wrote:
To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file. | |||||||||