Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

move();

multiply();
cleanUp();

}
private void multiply() {
while (beepersPresent()) {
moveTheBeepers();
returnTheCoveredBeepers();
moveToSecondTray();

}
}
private void moveTheBeepers() {
pickBeeper();
move();
while(beepersPresent()) {
duplication();
}
}
private void duplication() {
pickBeeper();
move();
putBeeper();
move();
putBeeper();
turnAround();
move();
move();
turnAround();
}
private void returnTheCoveredBeepers(){
move();
move();
while(beepersPresent()) {
pickBeeper();
turnAround();
move();
move();
turnAround();
putBeeper();
move();
move();
}
}
private void moveToSecondTray() {
turnAround();
move();
move();
move();
turnAround();
}

private void cleanUp() {


move();
while(beepersPresent()) {
pickBeeper();
}
turnAround();
move();
move();
turnAround();

You might also like