Example #1
0
int main() {
	
	setup();
	
	printf("Hello World! \n I'm Martha and you're about to get rekt. \n");
	
	printf("To the poms! \n");
	move(1500,2);
	system("clear");
	
	printf("Munch munch munch... \n");
	turn(1,1);           // swing around to gather poms
	sweeper(-1,10);
	system("clear");
	
	printf("To the poms! \n");
	move(800,5);
	system("clear");
	
	printf("Munch munch munch... \n");
	turn(2,-1);           // swing around to gather poms
	sweeper(-1,10);
	system("clear");
	
	printf("To the line! \n");
	move(800,5);
	system("clear");
	
	lift();
	move(100,1);
	
	system("clear");
	printf("Sorting... \n");
	
	decide();
	decide();
	decide();
	decide();    // eight times because eight poms
	decide();
	decide();
	decide();
	decide();
	
	system("clear");
	printf("Backing up... \n");
	move(-500,1);       // back up to avoid vertical projection of bins
	msleep(1000);
	mav(leftWheel,0);
	mav(rightWheel,0);
	
	return 0;
}
Example #2
0
int zone::findReplCandidates(int needed) {
  // find replacement candidates; stop if > needed bytes found or if
  // there seem to be no more candidates
 # ifdef NOT_IMPLEMENTED
  int reclaimed = 0, iter = 0;
  while (iter++ < LRU_RETIREMENT_AGE && reclaimed < needed) {	
    int vis, recl;
    int limit = numberOfNMethods();		// because usedIDs may change
    int newTime = sweeper(limit, needed, &vis, &recl);
    reclaimed += recl;
    if (recl < needed && newTime > LRUtime + 1) {
      // next sweep wouldn't reclaim anything
      assert(vis == limit, "should have visited them all");
      LRUtime = newTime - 1;
      if (PrintLRUSweep) lprintf("\n*forced new LRU time: %ld", LRUtime);
    }
  }
  return reclaimed;
#endif
  return 0;
}