13AlgorithmReview

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

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

Review Comp 106 Basic Constructs Of Programming • Sequence • Repetition • Decision

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

View Full Document
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!
Decision • If (<condition>) : <block of commands> Else <block of commands> Endif Indentation is important!

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

View Full Document
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
Ask a homework question - tutors are online