Homework 5 10-29-09 robot controls

Homework 5 10-29-09 robot controls - Alex Fidalgo 10/29/09...

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

View Full Document Right Arrow Icon
Alex Fidalgo 10/29/09 Intro to Programming E-115-C, E-115-LK I pledge that I have abided by the Stevens Honor System. _________________________ // YOUR PROGRAM STARTS HERE float leftfronthit, rightfronthit, rightbackhit, leftbackhit, nohit; fronthit = 'n' ; backhit = 'n' ; leftfronthit = 'n' ; rightfronthit = 'n' ; rightbackhit = 'n' ; leftbackhit = 'n' ; if ((bumpside == 1) || (bumpside == 2)) fronthit = 'y' ; if ((bumpside == 3) || (bumpside == 4)) backhit = 'y' ; if (bumpside == 1) leftfronthit = 'y' ; if (bumpside == 2) rightfronthit = 'y' ; if (bumpside == 3) rightbackhit = 'y' ; if (bumpside == 4) leftbackhit = 'y' ; if (bumpside == 0) nohit = 'y' ; if ((nohit = 'y' { movedir = 0.; rotdir = +1.; } else { movedir = +1.; rotdir = 0.; } if (fronthit == 'y' ) { movedir = -1.; rotdir = +1.; } else if (backhit == 'y' ) { movedir = +1.; rotdir = +1.; } else if (leftfronthit == 'y' ) {
Background image of page 1

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

View Full DocumentRight Arrow Icon
movedir = -1.; rotdir = +1.; } else if (rightfronthit == 'y' ) { movedir = -1.; rotdir = -1.;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Homework 5 10-29-09 robot controls - Alex Fidalgo 10/29/09...

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

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