Download presentation
Presentation is loading. Please wait.
Published byDonald Arnold Modified over 5 years ago
1
Adaptable Procedures By Phil Bagge HIAS Computing Inspector / Advisor
CAS Community Leader Author of the code-it resources Supported by
2
You may remember these basic procedures walk, eat and breathe
Define breathe Breathe in Wait Breathe out wait Define walk Move right leg forward Wait Move left leg forward wait Main Algorithm Loop always breathe if need to go somewhere walk if hungry AND food near eat Procedures Define eat Put food in hand Lift hand to mouth Put food into mouth Loop until a paste chew swallow
3
Adaptable procedures are ones where we can add information to the procedure every time we run it.
Define walk (wait time) Move right leg forward Wait (wait time) Move left leg forward Walk (2 seconds)
4
Adaptable procedures are ones where we can add information to the procedure every time we run it.
Which will cause the procedure to walk faster walk (1 second) or walk (2 seconds) ? Define walk (wait time) Move right leg forward Wait (wait time) Move left leg forward Walk (2 seconds) Walk (1 second)
5
Adaptable procedures are ones where we can add information to the procedure every time we run it.
Which will cause the procedure to walk faster walk (1 second) or walk (2 seconds) ? Define walk (wait time) Move right leg forward Wait (wait time) Move left leg forward Walk (2 seconds) Walk (1 second)
6
We call the changeable part of a procedure a parameter
Walk (2 seconds) Define walk (wait time) Move right leg forward Wait (wait time) Move left leg forward
7
Here is another everyday example
Define breathe (wait time) Breathe in Wait (wait time) Breathe out Loop always breathe (0.5 seconds)
8
Adaptable procedures can be used alongside basic ones
Define walk (wait time) Move right leg forward Wait (wait time) Move left leg forward Define breathe (wait time) Breathe in Wait (wait time) Breathe out Main Algorithm Loop always breathe (1 second) if need to go somewhere walk (1.5 seconds) if hungry AND food near eat Define eat Put food in hand Lift hand to mouth Put food into mouth Loop until a paste chew swallow
9
Here is another everyday example
Define tongue_out (wait time) Poke tongue out Wait (wait time) Hide tongue tongue_out ( ) On your whiteboard change the parameter and see if your partner can act it out
10
Here is another everyday example
tongue_out ( ) Define tongue_out (wait time) Poke tongue out Wait (wait time) Hide tongue Can you use this adaptable procedure within a count controlled loop? Write one for your partner to act out
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.