CS320n Visual Programming - PowerPoint PPT Presentation

About This Presentation
Title:

CS320n Visual Programming

Description:

Thanks to Wanda Dann, Steve Cooper, and Susan Rodger. for ... Learn some techniques in Alice. Practice Writing methods and functions. Visual Programming ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 15
Provided by: sco1
Category:

less

Transcript and Presenter's Notes

Title: CS320n Visual Programming


1
CS320n Visual Programming
  • Problem Solving Case Study
  • (Slides 6-3)

Thanks to Wanda Dann, Steve Cooper, and Susan
Rodger for slide ideas.
2
What We Will Do Today
  • Look at a complicated problem
  • Discuss different ways of solving it
  • Learn some techniques in Alice
  • Practice Writing methods and functions

3
Problem to Solve
  • Create a scene with 3 animals standing in a row
  • resize each of them from 0.5 to 3 times its
    original size
  • Find the animal that is tallest and spin it once
    to the right and once to the left
  • Sort the animals by their height smallest on the
    cameras left, tallest on the cameras right
  • Display message In order any time the animals
    are sorted

4
Objects in the World
  • Animals Penguin, Joey, White Rabbit
  • careful to pick animals whose center point is at
    their feet
  • challenging if center point is higher
  • position animals 1 meter apart (use move to and
    move methods in set up)
  • Need some way to track position
  • fixed objects (balls)
  • 3D text In Order! in scene but invisible

5
Initial Scene
tennis ball is position 1, toy ball is position
2, volleyball is position 3 Use these as fixed
points of reference
6
Storyboard
  • check if animals are sorted
  • resize animals
  • check if animals are sorted
  • make tallest spin
  • sort animals
  • display in order (assuming sorted)

7
world.my first method
8
make Tallest Animal Spin Around
  • find out which is tallest
  • spin it around right, then spin it around left
  • create a function to determine which of the three
    things is tallest

9
tallest Of Three
  • How do we do this?
  • Its not so bad for 3 but if there were more it
    would become too complicated

10
check If Sorted By Height
  • How do we check if items are sorted by increasing
    height?
  • Check if object in position 1 is shorter than
    object in position 2 and if object in position 2
    is shorter than object in position 3?
  • How do we know which animal is in which position?

11
which Object Is Closest To
12
sort Animals By Height
  • How?
  • More than one way?
  • Again, if we get more than 3 becomes very
    complicated, very quickly

13
One Way
  • determine which thing is in which position
  • determine which thing is tallest
  • if tallest is not in position 3, swap tallest
    with thing in position 3
  • then check if the thing in position 2 is taller
    than the thing in position 1
  • if not then swap those 2
  • animals next to each other started out 1.5 meters
    apart
  • or could use distance to the left / right function

14
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com