{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lab 06 - We are the Robots

# Lab 06 - We are the Robots - East is the positive X...

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

CIS*1500 – Week #7 Computer Lab #6 Case Study : We are the robots Duration: 50 minutes Topics: strings loops conditional (switch, if, else) This lab is designed to closely follow the classroom lab this week. Introduction: In this week's activity we will write a program to control, or “interface” with a robot designed to drive around the surface of mars, and collect samples. The robot understands six commands: N – This causes the robot to move north, 1 m. E – This causes the robot to move east, 1 m. S – This causes the robot to move south, 1 m. W – This causes the robot to move west, 1 m. \$ - This causes the robot to collect a sample at its current location. X – This terminates the robot. The robot moves about an X-Y axis and begins at the position (0,0).

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: East is the positive X direction; West is the negative X direction. The robot will read a command (a string of characters from the user), and then perform the movements, sample collecting, and exit. Example: If the command entered is: NNEE\$X The robot will move from (0,0) to (2,2), collect a sample, and then terminate. Example: If the command entered is: SSSW\$X The robot will move from (0,0) to (-3,-1), collect a sample and then terminate. Example of the interface: Example of running the program (with input NNSE\$W\$X) : Example of running the program (with input NESW\$X) : Example of running the program (with input NSSSS\$N\$N\$X) :...
View Full Document

{[ snackBarMessage ]}