1 / 14

CS320n –Visual Programming

CS320n –Visual Programming. Problem Solving Case Study (Slides 6-3). Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas. What We Will Do Today. Look at a complicated problem Discuss different ways of solving it Learn some techniques in Alice

fholmes
Download Presentation

CS320n –Visual Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 Problem Solving Case Study

  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 camera’s left, tallest on the camera’s right • Display message “In order” any time the animals are sorted Problem Solving Case Study

  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 Problem Solving Case Study

  5. Initial Scene tennis ball is position 1, toy ball is position 2, volleyball is position 3 Use these as fixed points of reference Problem Solving Case Study

  6. Storyboard • check if animals are sorted • resize animals • check if animals are sorted • make tallest spin • sort animals • display in order (assuming sorted) Problem Solving Case Study

  7. world.my first method Problem Solving Case Study

  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 Problem Solving Case Study

  9. tallest Of Three • How do we do this? • It’s not so bad for 3 but if there were more it would become too complicated Problem Solving Case Study

  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? Problem Solving Case Study

  11. which Object Is Closest To Problem Solving Case Study

  12. sort Animals By Height • How? • More than one way? • Again, if we get more than 3 becomes very complicated, very quickly Problem Solving Case Study

  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 Problem Solving Case Study

  14. Problem Solving Case Study

More Related