/* 0-0-0-0-1-1-1-1 0-0-1-1-0-0-1-1 0-1-0-1-0-1-0-1 —-1-1-c-1-c-c-1c */ void addFast(){ repeat(8){ addColumn(); } } void addColumn(){ if(!onBeeper() && !beeperAhead()){ moveForward(); if(beeperAhead()){ /* Uncommenting the two lines below will make the job more beautiful, but will also unfortunately fail the tests */ /* moveForward(); pickBeeper(); */ add1AtTheBottom(); } moveEnd(); moveToNextColumn(); moveEnd(); turnAround(); } else if((onBeeper() && !beeperAhead()) || (!onBeeper() && beeperAhead())){ moveForward(); if(beeperAhead()){ dropCarry(); } else { add1AtTheBottom(); moveToNextColumn(); } moveEnd(); turnAround(); } else { /* Both digits are 1 */ moveForward(); if(beeperAhead()){ /* Uncommenting the two lines below will make the job more beautiful, but will also unfortunately fail the tests */ /* moveForward(); pickBeeper(); */ add1AtTheBottom(); dropCarry(); } else { dropCarry(); } moveEnd(); turnAround(); } } void moveToNextColumn(){ turnRight(); moveForward(); turnRight(); } void moveEnd(){ while(frontIsClear()){ moveForward(); } } void dropCarry(){ moveEnd(); moveToNextColumn(); moveForward(); dropBeeper(); } void add1AtTheBottom(){ moveEnd(); dropBeeper(); }