Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 14 Online
OpenStudy (anonymous):

On problem set 11: the robots are fine at speed 1, but setting the speed to 10, for example, makes them hop around, cleaning squares every 10 moves away. Any tips on how to increase speed while updating position along the way so that I don't have apparating robots?

OpenStudy (anonymous):

Also, on a semi-related note: I am running python version 2.7 on a mac and I can't get numpy or pylab to download. Even after making sure the versions map up. Do I have to download it to a certain place on my computer for python to find it?

OpenStudy (anonymous):

No, I don't think there's a way to actually 'update' your robot's position, since your speed is the minimum distance your robot will travel in one move, and it's constant. You can however make the robot clean the hopped areas, which it otherwise would've skipped. To do this, it would involve some vector calculation. In this case, it's simplified, since we don't really need angles. I haven't got to ps11 myself, but this is the logic I would use: 1. Determine the coordinate of starting point a(x1, y1) 2. Determine the new direction the robot is facing 3. Determine the coordinate of target point the robot's gonna travel to b(x2, y2) 4. Move the robot there (x1 + s, y1 + s) 5. Calculate the points which the robots just skipped. This can be done by the usual (x1 + s, y1 + s) except in this case s = range(1, actual s + 1). You can then store the results in a list or a tuple. 6. Clean those points. There. Though I don't see why you would in crease it's speed. I don't see any problem there that requires you to change the speed, but I also know that I'm a lousy reader and like to skip things :P If it's not required, then I suggest don't change it. It will also bring trouble about collision detection when the robot hits the wall.

OpenStudy (anonymous):

you could always put a function call within your update method, that is called for once for each speed (this would give you trouble with decimals though), the outer piece of update chooses direction and if its a valid move, then you move one space at a time cleaning as you go. otherwise you could apply the logic that if the robot is moving so fast, it can't really clean

OpenStudy (anonymous):

don't have a mac ... did you download a binary installation package?: http://matplotlib.sourceforge.net/faq/installing_faq.html#os-x-questions http://matplotlib.sourceforge.net/faq/installing_faq.html#installing-osx-binaries

OpenStudy (anonymous):

haha, I like the moving too fast idea, and the vector calculation would work I suppose but it would get quite messy when the robot hits the wall and has to move on. I guess I was just a little thrown by the speed parameter. Thankfully the speed doesn't really matter for the rest of the problem. Also, thank you bwCA for the computer troubleshooting, but I think I got it now. After a few frustrating days and endless google searches, I was led back here to a similar open study question asked 5 months ago, and it cleared everything up!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!