DIESEL - PowerPoint PPT Presentation

1 / 60
About This Presentation
Title:

DIESEL

Description:

... involved in making the coffee? Assume a filter. coffee maker and fresh beans. ... Put new filter in coffee maker. Grind beans. Put grounds in filter. Boil water ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 61
Provided by: ISGr7
Category:
Tags: diesel | beans | coffee

less

Transcript and Presenter's Notes

Title: DIESEL


1
Multimedia Authoring COM315
Lecture 4 Algorithm development Overview of lingo
2
Algorithm Development
3
Algorithm Development
  • What is an algorithm?
  • Programming languages for computers works in
    sequential steps unless told to branch off or
    repeat something.
  • Tasks must be analysed with this in mind. This
    development process is called algorithmic
    thinking.

4
Pseudo Code
  • Algorithm development is done in Pseudo Code,
    (Almost human language)
  • This process should precede all but the most
    trivial programming operations.
  • Lecture focuses on algorithm development
  • Some Lingo conventions used to help transition to
    real code.

5
Where do I start?
  • The most common question in program
  • development is Where do I start?. The
  • answer is
  • State your assumptions.
  • Break your task down into smaller tasks.
  • Formulate step by step instructions to carry out
    each of the smaller tasks.

6
Programming example
  • Task
  • Give instructions for making and serving coffee
    while reading the paper before breakfast.

7
Assumptions
  • Assumptions
  • Instructions are for a machine that has the
    physical abilities of a human but is as literal
    minded as a computer.
  • So, it can pick up a coffee pot but will have to
  • be told exactly what to do and when to do it.

8
Task Decomposition
  • There are two main parts preparing the coffee
  • and reading the paper.
  • Initial algorithm
  • Prepare coffee
  • Read paper
  • Proceed using stepwise refinement

9
Stepwise refinement
  • Our initial twostep algorithm can first be
  • broken into three steps.
  • Make coffee
  • Serve coffee
  • Read paper

10
Stepwise refinement
  • What is involved in making the coffee? Assume a
    filter
  • coffee maker and fresh beans.
  • Put new filter in coffee maker
  • Grind beans
  • Put grounds in filter
  • Boil water
  • Pour boiling water over grounds
  • Let drip
  • Serve coffee
  • Read paper

11
Procedures Handlers
  • Algorithm description soon becomes a long and
    confusing list of instructions.
  • Programming languages allow you to hide detail by
    declaring procedures or handlers (Lingo).
  • Create handler called MakeCoffee

12
Handlers
  • MakeCoffee
  • Serve coffee
  • Read paper
  • MakeCoffee step closer to Lingo code format

13
on MakeCoffee Handler
  • on MakeCoffee
  • Put new filter in coffee maker
  • Grind beans
  • Put grounds in filter
  • Boil water
  • Pour boiling water over grounds
  • Let drip
  • end MakeCoffee

14
Program execution
15
Comment conventions
  • Add comments
  • Improves readability later understanding
  • Ignored by the machine but help make the
    algorithm intelligible to humans.
  • --This is a comment in Lingo.
  • --Lines beginning "--" ignored by the machine.

16
(No Transcript)
17
Variables
  • To date we have only organised the instructions
    in
  • program development. We need to organise
  • information as well.
  • E.g. Specify how much milk and sugar to serve
  • with the coffee?
  • We will use the construct called a variable.

18
Variables
  • A variable is simply a container that holds a
  • value we specify and should have meaningful
  • names.
  • Define two variables
  • NumberOfSpoons
  • TakesMilk

19
ServeCoffee handler
20
Conditional action
  • IF ltconditiongt THEN
  • Action(s)
  • END IF
  • If the condition is not met, the action(s) are
    not
  • performed. Program moves on to the next
  • instruction in the sequence.
  • Known as a Branch.

21
Variables values
  • Variables have to be assigned values before
  • they can be used.
  • This will be done in the main program.

22
Variables values
23
Local global variables
  • Lingo would not know about these variables in the
    main program as they are introduced in the
    handler ServeCoffee.
  • Variables which will be used only within a
    handler are called local
  • Variables which can be used by other handlers (or
    movies) are called global.
  • Globals have to be declared as such and given a
    value before being used.

24
Global variables
25
Variables
  • Suppose we wish to serve coffee to more than
  • one person. We can now make further use of
  • the variables by giving them different values for
  • the second serving.
  • The algorithm for the main program now
  • becomes

26
Variables
27
Arguments
  • Once we start using variables and handlers
  • more than once, we run the risk of having to
  • keep track of lots of values as the main
  • program grows longer. It would be simpler if our
  • procedures could be supplied with values as
  • they were called.

28
Arguments
  • For example, we could then call ServeCoffee
  • like this
  • ServeCoffee(2, yes)
  • Which means two spoons of sugar with milk.

29
Arguments
  • This is a lot more concise and readable than
  • set NumberOfSpoons 2 --two sugars
  • set TakesMilk yes --and milk
  • ServeCoffee

30
Arguments
  • ServeCoffee must be rewritten to know that it
  • will receive the information in this form.
  • In Lingo, variables passed to a handler are
  • called parameter variables or arguments.

31
Arguments
32
Concise programs
33
Summary
  • Algorithms
  • stating assumptions
  • decomposition
  • stepwise refinement
  • execution flow
  • comments

34
Summary
  • Procedures
  • handlers (defining a procedure)
  • parameters and arguments

35
Summary
  • Variables
  • declaring a variable
  • initialising a variable
  • assigning a value to a variable

36
Summary
  • These steps are the basis of successful
  • programming. The more you use them, the
  • easier you will find them to understand.

37
Introduction to Lingo
  • Lingo is Director's programming Language
  • Allows advanced interactivity in a Movie
  • Reasonably straightforward to use
  • But it is a programming language !!!!

38
Lingo Events
  • All Lingo commands get executed by the start
  • of an event Event handler
  • on mouseup
  • on mousedown

39
Structure of Lingo Command
  • On MouseDown
  • Go to Frame 1
  • End
  • On --- (Signals an event)
  • MouseDown (The event)
  • Go to (The command)
  • Frame 1 (The expression)
  • End

40
Handlers
  • Handlers are several lingo commands put
  • together to perform a task
  • On MouseDown
  • Go to Frame 1
  • End

41
Types of Lingo scripts
  • Primary event handlers
  • Sprite scripts (Behavior)
  • Cast scripts
  • Frame scripts
  • Movie scripts

42
Handling Hierarchy
  • Primary event handler
  • Sprite Script
  • Cast member Script
  • Frame Script
  • Movie Script

43
Handling Hierarchy
44
Lingo Grammar
45
Lingo Grammar
46
Lingo Grammar
47
Sprite properties
48
Lingo sprite properties
49
Rollover Example
Member specifies a sprite's cast member and
cast
50
Lingo condition statements
51
Draggable Behavior
52
Behaviors
  • A set of Lingo commands that controls the
  • action of a Sprite. Director comes with some
  • Pre made behaviors that your can use as-is, or
  • edit to fit your needs.
  • Example Hold on current frame

53
Questions on project
  • Questions on group project

54
Team presentations
  • There will be a team presentation of completed
    work on Week 7, 06/11/08 _at_ 9.15 in MBO10
  • 15 Minutes per team, 10 minutes presentation, 5
    minutes questions
  • Each team member must attend, participate and
    present!
  • All class members must attend all sessions!

55
Schedule
  • Team 1 MC Building 9.15
  • Team 2 ME Building 9.30
  • Team 3 MR Creche 9.45
  • Team 4 MM Library 10.00
  • Team 5 MI - Aberfoyle House 10.15
  • Team 6 MQ Foyle Arts 10.30
  • Team 7 MS - ISRC Research building 10.45

56
Assignment 1 Mark Allocation
57
Assignment 1 Deliverables
  • Digital copy of storyboard/planning process in
    powerpoint CDROM/Building (on CDROM)
  • This includes concept sketches/plans/photos
  • Macromedia Director CDROM presentation
  • Director source code
  • Bio/images of Team Avatars
  • Images/video of construction process of building
    in Second Life
  • Video of walkthrough of completed building
  • Copy of group presentation from Week 7

58
Submission Deadlines
  • Assignment 1 31/10/08 (Week 6)
  • Assignment 2 12/12/08 (Week 12)
  • Assignment 3 11/12/08 (Week 12)

59
Lab week 4
  • ½ Hour Second Life
  • Director

60
Multimedia Authoring COM315
Lecture 4 Algorithm development Overview of lingo
Write a Comment
User Comments (0)
About PowerShow.com