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

PSET11, General question: When I sped up my robot, from speed = 1 to speed = 2, the number of steps didn't significantly decrease, which didn't make sense until I realized the way we're told to code them is they only clean at the end of their movement, rather than like the real robots. Question to follow.

OpenStudy (anonymous):

While I'm okay with this disconnect between the model and reality for the purposes, I'm wondering what a good way to code it would be for my own edification. Since they move (and clean) stepwise, I can't think of a way to do realtime cleaning of the floor, but without this, the model makes the robots glide over unclean tiles without doing anything whenever they're set to speeds over 1.

OpenStudy (anonymous):

you could do something like - where was i before i moved, where am i now, which tiles did i cross, mark those tiles as clean. this might be fun: define time by the distance traveled - so a speed of 1 you get one timetick by moving one tile width. with a speed of two you get one timetick by moving two tile widths. and the bot moves one tile width per step. or maybe get a little finer control and define speed one as one tick per ten bot steps at 10 botsteps per tile width - the bot keeps stepping till time ticks and along the way at every step look to see if you are on a new tile and cleanit

OpenStudy (anonymous):

Yeah, i could definitely break each timestep into multiple timesteps and jack up the number of times I call updateAndClean. If I do that, though, if the robot ends up on the corner of a tile and cleans it all. I guess that comes down to reducing the size of each tile.

OpenStudy (anonymous):

i think that might be happening anyway - when you are traversing the tiles at angles, you are never going to end up smack dab in the middle, occasionally it will be on a corner - and we are already saying that if you are on a tile it is clean

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!