Noises seem to work, but test cases won't budge...

I am stuck. It seems like my functions move and sense both work well! Yet, I cannot seem to get either of the two test cases to work. Below is how I tried to test my functions, and below that is the output I got. It seems right to me. Yet, my code doesn't work when I run it in either of the two test cases. After hours and hours I need a hint or some feedback. From what is below, does it seem like my functions are working correctly? (I am new to python and programming in general)

MY TEST:

r = robot()

print r

r.set_noise(bearing_noise, steering_noise, distance_noise)

print r.sense(0)

print r.sense()

r.move([pi/8.0,10])

print r

print r.sense(0)

print r.sense()

THE OUTPUT:

[x=98.539 y=72.225 orient=2.9426]

[1.789941734142201, 0.83143434899682944, 6.2073800961397936, 4.858777250229493]

[1.9061385508961166, 0.87548989086415929, 0.27913135700035602, 4.7692528026139129]

[x=82.396 y=73.891 orient=3.1348]

[1.8114322113021917, 0.73779931010396638, 5.9830996144865036, 4.1259231987578717]

[1.76619478266442, 0.72160124078836407, 5.8582556808143087, 4.1367433229995934]

To me it seems like all three noises are working correctly. Is that correct? And if so, how come the test cases don't work, if all we have to do is correctly implement the noises into the move and sense functions?

Thank you so much for your help!

asked 11 Mar '12, 01:07

Alex%20Heaton's gravatar image

Alex Heaton
68210
accept rate: 0%


2 Answers:

Taking a quick look at the output, you are moving the robot a distance of 10 but the x coordinate has moved by approx 16. You should check your move function.

link

answered 11 Mar '12, 01:16

david%20radnell's gravatar image

david radnell
14413

Don't forget that r.move() should return a new robot rather than modifying the existing one. When you do that, you should make sure that the newly created robot has the same properties as the old one (length and noise values). I'd start by checking that...

link

answered 11 Mar '12, 01:20

Matt%20Bell's gravatar image

Matt Bell
2.1k31342

Yep. That was it. I am now going to think about why that matters, because I don't quite understand that. Thank you so much for the help.

(11 Mar '12, 01:29) Alex Heaton Alex%20Heaton's gravatar image
Your answer
Question text:

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×5,185
×183
×37

Asked: 11 Mar '12, 01:07

Seen: 159 times

Last updated: 11 Mar '12, 01:29