13AlgorithmReview

13AlgorithmReview - Exercise 1 • Convert the RCX program...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Review Comp 106 Basic Constructs Of Programming • Sequence • Repetition • Decision
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Commands… • Forward (time/variable) • Backward (time/variable) • Turn_right (time/variable) • Turn_left (time/variable) • Spin_right (time/variable) • Spin_left (time/variable) • Set <variable> to <value || sensor || timer> • Add <number> to <variable> • Subtract <number> from <variable> • Reset <timer> Repetition • Repeat For <n/variable> times: <block of commands> • Repeat Forever: <block of commands> • Repeat Until (<condition>) : <block of commands> • Repeat While (<condition>) : <block of commands> Indentation is important!
Background image of page 2
Decision • If (<condition>) : <block of commands> Else <block of commands> Endif Indentation is important!
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Exercise 1 • Convert the RCX program into pseudo-code Exercise 2 • What is the pseudo-code for this RCX program? • What does it do? Exercise 3 • Assume that it takes 1 second to spin 90 degrees. • (Step 1) Write a program in pseudo-code to make the roverbot drive in a square, with each side of the square being 1 second long. • (Step 2) Write a program in pseudo-code to make the roverbot drive in a square forever. After completing each square, the sides of the next square will be 1 second longer than the previous one. Exercise 4 • Write a program in pseudo-code so that the roverbot is going forward forever, and if sensor 1 is pressed, the robot beeps....
View Full Document

This note was uploaded on 09/16/2010 for the course COMP 106 taught by Professor Jasonmadar during the Fall '07 term at Capilano.

Page1 / 5

13AlgorithmReview - Exercise 1 • Convert the RCX program...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online