The row of beepers sometimes has gaps in between the beepers, in which case this code works well, but if beeper piles are adjacent, the robot ends up dumping the first pile onto the second pile and I don't know how to pick up the second pile's beepers because now the second pile's beepers are comprised of the first and the second piles beepers and I don't know how to pick up only the second piles beepers. While(count > 0) //after moving 1 space to the right, it drops the beepers While(arg.nextToABeeper()) //the robot will pick up the beepers in the pile, and keep a tab of them While(!arg.nextToABeeper()) //the robot will move until it finds a beeper I think I have a good start, I wrote the code to pick up a pile of beepers, move one to the right, and drop those beepers: public static void shift(Athlete arg) So my current task is to create an algorithm that shifts the piles of beepers in a row 1 space to the right.
0 Comments
Leave a Reply. |