Download presentation
Presentation is loading. Please wait.
1
1 Fall 2008ACS-1805 Techniques for designing code Storyboards Text (aka pseudocode) Diagrams Flowcharts (a procedural technique) Text presents one of these for the If/Else structure Directed lines indicate flow of execution
2
2 Fall 2008ACS-1805 Techniques for designing code Do the following steps in order alien moves up alien says "Slithy toves?" robot's head turns around robot turns to look at alien Do together robot moves toward the alien robot legs walk alien moves down robot turns to face the camera robot blushes robot says “Houston, we have a problem!” A storyboard in text form:
3
3 Fall 2008ACS-1805 Flowchart for Action Sequence Action 2 Action 1 A simple sequence of actions. …
4
4 Fall 2008ACS-1805 Action Sequence A simple sequence of actions is a Do in order structure in Alice
5
5 Fall 2008ACS-1805 Parallelism Action nAction 1 If a set of actions are to be done at the same time they can be represented as parallel operations (see Fig 2-2-17) …
6
6 Fall 2008ACS-1805 Parallel Set of Actions A Do together structure in Alice specifies that certain actions are to be done at the same time… i.e. in parallel
7
7 Fall 2008ACS-1805 Flowchart for If/Else expression action(s) when falseaction(s) when true falsetrue An if/else results in exactly one of two actions being executed depending on the truth or falsity of some expression
8
8 Fall 2008ACS-1805 If/Else expression when true when false
9
9 Fall 2008ACS-1805 Flowchart for Loop index < limit? Loop action(s) false true Loop action(s) are executed while an index goes from 0 up to a limit Set index to 0 Increment index
10
10 Fall 2008ACS-1805 Loop Loop action(s) executed while an index goes from 0 up to but not including a limit *Also: see the more complicated version of loop
11
11 Fall 2008ACS-1805 A flowchart for Robot Discovering Alien Alien moves up Alien says “Slithy toves?” Robot turns head around Robot faces alien Alien moves down Robot faces camera Robot blushes Robot says “Houston, we have a problem!” Robot moves 1m towards alienRobot leg movesRobot other leg moves Index 0 Limit distance between alien and robot Increment index false Where does the If/Else from the other day fit into this? stop start Index < limit true
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.