CMPS 002 - Computer Literacy

Prof. Paulo Franca

CyberSlug Rules!

Classes

Class Syllabus

Grading Policy

Labs

Interact

Login

  • enter system
  • get attendance
  • submit work
  • take lab quiz
  • check scores

Help

Help me!

Links

Staff only

 

 

 

Datacare   Ahshay

 

go outside

First how can we make robot move from start to the lower right corner of room?

  • First step might be
    WHILE front-is-clear DO
     Begin
     move
     End
  •  Alternatively
    WHILE right-is-blocked DO
     Begin
     move
     End
 
  • Refinement
    WHILE right-is-blocked DO
     Begin
     IF front-is-blocked THEN
     Begin
     turnleft
     End
     move
     End
 
  • thus robot reached corner and turns left
  • reaches next corner and turns left
  • robot would stop at the doorway

 

  • Finally add other pieces to go outside task
    WHILE right-is-blocked DO
      Begin
      IF front-is-blocked THEN
      Begin
      turnleft
      End
      move
      End
      turnright
      move