Sunday, October 07, 2007

How Stuff Works

http://science.howstuffworks.com/engineering-channel.htm
This site is a wealth of information on everything mechanical!

Making Electronic Dice


Wingding Dice

    Understanding the Concept

    Imagine that you wished to display a die on a 3 x 3 spreadsheet.
    First, let¼s analyze the details of what we want:

    If a die is split up into 9 sections, then each of the 9 sections may contain a black dot. For the number 1, only B2 contains a black dot, for the number 2, A1 and C3 contains dots, and so on.
    Consider that the number is x. Then we appear to have the following rules:

    B1 and B3 are always empty
    A1 and C3 contain a dot, for any number greater than 1
    A2 and C2 contain a dot only when the number is 6
    A3 and C1 contain a dot for any number greater than 3
    B2 contains a dot for odd numbers.

    If you use the font: Wingdings, you will find that many letters have interesting symbols. You might choose the letter "l" (lower case "EL") for a dot.

    In order to place the character in these spots at the appropriate times, we need 3 functions from the spreadsheet:

           =RAND(number)
    =IF(logical,trueÝvalue,falseÝvalue)
    =or(logical1,logical2,ä)

    =RAND(number)
    This will generate a random number. For example, RAND(6) will generate one of the digits 1,2,3,4,5 or 6. The lowest number is always 1, the highest possible number is the value in brackets.

    =IF(logical,.trueÝvalue,.falseÝvalue)
    The field inside the brackets are divided into 3 parts, separated by commas. In the first field place the question. For example: x>1, a = b. In the second field place the content of the cell, if the answer to the question is YES. In the third filed place the content of the cell, if the answer is No. Example: IF( A1 > 50 , "PASS" , "FAIL")

    =or(logical1,.logical2,...)
    If any one of several possibilities is possible use the or function. For example if a number x could be 1 or 3 or 5 you should use: or( x=1 , x=3 , x=5 )

    A functioning die in a 3x3 spreadsheet might look like this (given that the value of x is found in cell A4)



    Detailed instructions:

    1. Open a new Spreadsheet document in AppleWorks 5.0.

    2. From the Format menu, select Document and limit the number of columns to 7 and the number of rows to 4

    3. Then in cell A4 type the formula: =RAND(6). This is the random number that will be displayed in the 3x3 set of cells.

    4. Copy the formulas displayed in the figure above into the appropriate cells.

    5. Select the range of 3x3 cells A1..C3 and change the font to Wingdings (In the Format menu select Font and Wingdings)

    6. Select the range of 4x3 cells A1..C4 and select Copy from the Edit menu. Move the cursor to cell E1 and select Paste from the Edit menu.

    7. Select all cells and change the Size to 14 (In the Format menu select Size) Change the Row Height to 20 and the Column Width to 20 (both found under the Format menu). Change the Alignment to Center (also found under Format)

    1. Select the 3x3 cells A1..C3 and change the background colour to red: From the palette bar (see right) select the appropriate fill colour. If the palette bar is not visible to the left of your screen, click the palette toggle found at the bottom of the window, just right of the "big mountain".

    2. While cells A1..C3 are selected, choose Borders under the Format menu and select Outline.

    3. Select the 3x3 cells E1..G3 and change the background colour to blue. Select Outline for this group of cells also.

    4. Select all cells and change the Text Color to white (under the Format menu)

    5. Move the cursor into cell D4 and type the formula: =A4+E4. Change the text colour to a friendly green and bold it. (Under Format, choose Style). Change the Column Width to 36, so that you can display a 2-digit number (Under Format)

    6. Finally, under Options choose Display and take away all the checkmarks. Select all cells and Lock them (under Options)

    On the Macintosh, hold down the command and shift key, while repeatedly pressing the = sign. Note that the two dice change values randomly. In Windows, hold down the CTRL and shift keys instead.


    Sponsored by ECOO and SIG-Computer Science

    .