www.alice.org

www.alice.org

Arithmetic Expressions http://www.alice.org/resources/lessons/arithmetic-expressions/ Arithmetic Expression What is an Arithmetic Expression Traditional math and formula computations are implemented as arithmetic expressions in a computer program. An arithmetic expression: - is a combination of operators and operands evaluates to a numeric value Arithmetic Expression

Operand Types A numeric operand can be either A whole number (integer) Or a floating pt number (decimal number). This also includes functions that resolve to a whole number or decimal - Get distance, get width, and get double or integer from user Arithmetic Expression Operators Arithmetic operators are mathematical function that takes two operands and perform a calculation on them such as: Addition +

Subtraction Multiplication Division / Remainder (mod) * % Alice also supports mathematical functions that can be performed such as resolving between a minimum or maximum value, getting the square root, or even sine or cosine. Arithmetic Expression Creating Arithmetic Expression In Alice these can be accessed using the Math

drop down menu item when modifying a parameter that uses the whole number or decimal data type. You first select the operator and then select the operands. You can use placeholders that you then replace with functions or variables. Alice in most cases assumes a binary expression but you can string multiple arithmetic expressions together by further modifying operands. Arithmetic Expression Common Uses of Arithmetic Expression Common uses of mathematical equations in Alice are:

- To modify a distance or spatial relationship - To calculate a number of iterations for a count loop - To increment or decrement a variable Arithmetic Expression Calculating a Distance In Alice the location of an object in space is

often unknown due to the way you build your scene. Using the get distance function to determine how far to have something move can be an easy way to animate an object moving the distance. However because using the getDistance functions calculates the value based on the middle of the objects this function by itself will stack the objects on top of each other. A simple arithmetic expression can help you modify the statement to have the object stop just short of the target object. Arithmetic Expression

Calculating Number of Iterations In animation you may want to have a looping animation run an unknown amount of times to match another animation: - - having a certain amount of walking motions happen depending on the distance traveled Having the mouth move to match the duration of a dialogue You can have the number of loops = the distance or duration of a dialogue / the

duration or distance of the walk or talk cycle *Example uses integer divide to round off a whole number to be compliant with Loop data type Arithmetic Expression Incrementing and Decrementing When using variable you will often want to increment or decrement the value when events happen in the world such as: - TimeVariable - 1 to count down based on a timer event

ScoreVariable + 1 to track score based on a triggering event ItemsCollected + 1 to track an item count based on a triggering event *example shows a timer event triggered every second that decrements the time left variable

Recently Viewed Presentations

  • DISTANCE, SPEED & TIME - National 5 Maths

    DISTANCE, SPEED & TIME - National 5 Maths

    arrives in London at 1755. It travels 465 km. Calculate the average speed. 3. My journey takes me 4 hours 15minutes to complete at an average speed of 65km/hr. How far have I travelled? 21/01/11 Learning Intention To be able...
  • Evidence-Based EMail Management at UNC: A Search for

    Evidence-Based EMail Management at UNC: A Search for

    Lots of folks are filing their messages electronically (perhaps only electronically). We need to know how folks are filing. Conclusions We may need instruction/resources available in how to name and organize files. With so many folks filing messages electronically we...
  • El Naturalismo - WordPress.com

    El Naturalismo - WordPress.com

    Se denomina Naturalismo a una corriente literaria surgida en las décadas finales del siglo XIX. Fue impulsada por el autor francés Émile Zola. Llevó al extremo los presupuestos del realismo, mostrando los aspectos más sórdidos de la realidad Naturalismo Considera...
  • Zulu and Bantu - Mrs.Parr's Social Studies Classroom

    Zulu and Bantu - Mrs.Parr's Social Studies Classroom

    Bantu vs Zulu. Each group is responsible for creating a migration map of their assigned group and a timeline for their assigned group. The groups will also need to analyze the . impact these people have had on the region...
  • Seminar Electronic Payment Systems Sommer 2001

    Seminar Electronic Payment Systems Sommer 2001

    Schedule Cheating Everyone who cheats fails. Copying text from other authors in your paper / slides is not allowed! Copying ideas without referencing the authors is not allowed! You have to write all parts of your paper / slides on...
  • Advanced manufacturing Lab, Industrial Enginnering Dep ...

    Advanced manufacturing Lab, Industrial Enginnering Dep ...

    Graphics accelerator cards are video controllers that actually have a processor chip and a large amount of memory (say, a megabyte or more) to offload the display task from the CPU. Information Technology. Khatam Institute of higher Education. IT (Information...
  • video slide - Amphitheater Public Schools

    video slide - Amphitheater Public Schools

    Chapter 53 Community Ecology Primary succession Occurs where no soil exists when succession begins Secondary succession Begins in an area where soil remains after a disturbance Early-arriving species May facilitate the appearance of later species by making the environment more...
  • W.A. MOZART: la biografia, una passeggiata attraverso alcune ...

    W.A. MOZART: la biografia, una passeggiata attraverso alcune ...

    Pierre Antoine de Bavier, Maurizio Pollini,Pierre Fournier. Ha svolto un'intensa attività concertistica in Europa e negli Stati Uniti (qui, nel 1951, il compositore e critico musicale Virgil Thomson lo definì "indubbiamente il miglior quartetto del nostro secolo"). Il quartetto si...