Hi- trying to simulate a coin toss. I'm putting two objects in a holder - a circle and a star. I created two variables in the Holder, circleCounter and starCounter (one for heads, one for tails)
I assign the cursor of the Holder a random 1 or 2.
I don't know how to check the position of the cursor. The simplest way would just be: Test if cursor value == 1...
but I don't see that as a menu option.
So I'm trying: Test if graphic at cursor == Circle ... How do I do this - check the value of the graphic or item at the cursor in a holder?
The default value for "Test Holder's graphic at cursor..." is neither the circle or the star, how do I insert either of those two images into the Test?
Or can I just test the value of the cursor somehow? (Is it a 1 or a 2)
By the way, I've done this in Scratch, it seems easier to put together initially, but the speed is an issue. For alot of 'spins' - like 1000 or more, it may take in terms of minutes to finish. I think Etoys will be faster.
Also - can I output the results to a data file? It'd be nice to graph the results.
In Scratch, I put the results into data lists, these can be exported to .txt files with a right click on the list.
Thanks for your help, Randy Latimer
At Tue, 11 Oct 2011 13:02:09 -0400, R.D. Latimer wrote:
Hi- trying to simulate a coin toss. I'm putting two objects in a holder - a circle and a star. I created two variables in the Holder, circleCounter and starCounter (one for heads, one for tails)
I assign the cursor of the Holder a random 1 or 2.
I don't know how to check the position of the cursor. The simplest way would just be: Test if cursor value == 1...
but I don't see that as a menu option.
In the Holder's Viewer, there is a category called "collections" and there is a tile called "Holder's cursor". If you drop it to the Test part of test, you get the comparison there and you can change '>' to '='.
-- Yoshiki
I made a Coin Toss projecthttp://www.squeakland.org/showcase/project.jsp?id=11342that starts with an Etoys challenge for you to build your own coin toss race. You could ask kids what to run a bunch of races, compare results and if they noticed anything about the way the coins move.
I also played around with how to help folks find certain tiles on page 2 using Event Theatre. The problem with this approach is it doesn't work when you switch languages (because it records mouse position) Would be nice to have some way to add a "how to find this tile" mechanism, for etoys challenges and for folks looking at other peoples scripts. Perhaps an <alt><click> to help show where to find it.
Also on the last page is a visual that you can "scroll" to see the pattern of heads/tails. It broke down when I made the playfield length ~10,000 (the stamped, images re-arranged when I started scrolling.
Stephen
On Tue, Oct 11, 2011 at 1:02 PM, R.D. Latimer rdlatimer@gmail.com wrote:
Hi- trying to simulate a coin toss. I'm putting two objects in a holder - a circle and a star. I created two variables in the Holder, circleCounter and starCounter (one for heads, one for tails)
I assign the cursor of the Holder a random 1 or 2.
I don't know how to check the position of the cursor. The simplest way would just be: Test if cursor value == 1...
but I don't see that as a menu option.
So I'm trying: Test if graphic at cursor == Circle ... How do I do this - check the value of the graphic or item at the cursor in a holder?
The default value for "Test Holder's graphic at cursor..." is neither the circle or the star, how do I insert either of those two images into the Test?
Or can I just test the value of the cursor somehow? (Is it a 1 or a 2)
By the way, I've done this in Scratch, it seems easier to put together initially, but the speed is an issue. For alot of 'spins' - like 1000 or more, it may take in terms of minutes to finish. I think Etoys will be faster.
Also - can I output the results to a data file? It'd be nice to graph the results.
In Scratch, I put the results into data lists, these can be exported to .txt files with a right click on the list.
Thanks for your help, Randy Latimer
squeakland mailing list squeakland@squeakland.org http://lists.squeakland.org/mailman/listinfo/squeakland
squeakland@lists.squeakfoundation.org