FLOSS Manuals

 English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

Learning with Etoys: Imagine Invent Inspire ES

Tossing The Coin

Imagine what it would be like to toss a virtual coin. You will need to Invent a way to make your coin act like a real coin. It may Inspire you to design games and play.

In this project we use:

Painted images, Holder, holder's viewer, "Holder's player at cursor"; Holder's cursor; compose a composite tile

Project 

In this project, as in the Chapter 9 (Animation), we use one object (a coin) and change its look to mirror the images stored in an holder. We will 'toss' the coin and show how it falls; either heads or tails. In order for the coin to behave like a real one, the chance of falling on tails should be the same as the chance of falling on heads, but for any given toss we have no way to determine the exact result.  Instead of increasing the holder cursor by one to move in a sequential order, (as we did in Chapter 9), we will use a random number generator available in Etoys and assign its results to the holder's cursor.

Instructions: Open Etoys and click on the cloud that says Make a Project.

1. Paint or import images of the 2 sides of a coin.  Name these objects Head and Tail.

2. Put the tail and head objects in a holder (you find a holder in Supplies). Name the holder: coinsHolder.

. 


3. Paint an object that will later change its look to mirror those of the images in the holder. A simple colored spot will do. Give this spot the name of the object it is going to mirror, e.g. "coin". 

4. Open the spot's (coin's) viewer and open its graphics category. To do that, hold down the cursor on the word  "basic" in the viewer and then move down the list and click to select "graphics" from the names that appear. 

5. Drag the tile: "coin look like dot" out of the viewer and drop it. A Script Editor will open.

6. Open the holder's viewer. 

7. Select the "collections" category (see #4 above) and find the tile "holder’s player at cursor". Drag and drop it to replace the box in the script where the word "dot" is (A green frame around the word "dot" will let you know you are in the right place). By doing this you have just told the spot of color (coin) to look like the image in the holder where the cursor is currently located. This will be the image in the boxed frame.

8. In the Holder's viewer, drag the tile: "holder's cursor <-- 1 by its white assignment arrow and add it to the script.

To simulate a tossing, randomly assign the holder's cursor a number from the group {1,2} by using random(2) function. You can find information about the use of the random function in the Quick Guides under Scripting Tiles.

Name the script: CoinToss1 

The script for a coin toss will look like:

To simulate a visual change between two consecutive tosses, especially when there are two or more heads or tails in a row, one can add a small rotation to each toss. The "coin turn by" tile is found in the basic category of the coin viewer.  

The improved script looks like this:

Here are 3 games you can play:

 Coin Game 1*     Two players take turns tossing a coin twice at each turn.

          Player A wins when the result is two heads

          Player B wins when the result is two tails.

 Coin Game 2*      Two players take turns tossing a coin three times in a turn.

          The first player to get three heads in one turn wins.

 Coin Game 3*      Two players take turns tossing a coin three times in a turn

         Player A wins if result of a turn is two tails and one head (order is not important).

          Player B wins if the result of a turn is either all heads or all tails. 

* Some of the games are not fair.  They are designed so that one player is more likely to win than the other.  Have the students discuss this.   

Student's may also create their own games, some fair, some not.  

This project,  Coins Toss,  can be found at:  http://etoysillinois.org/library?sl=2132 

More Inspiration:

This project could enable you to create visualizations for other events for which we know the probability.  This type of event could include dice throwing events, simulations of infection disease spread and other questions of chance such as the probability of pulling a pair of matching socks out of a drawer.

Here is a project that uses a holder and a random number generator to simulate a Number-Cube throw and added games: Coins and Dice Games http://etoysillinois.org/library?sl=1531

Here is a project to illustrate and solve a probability question: Tale of Two Sons http://etoysillinois.org/library?sl=1952&viewProject

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.