/* Experiment with moving cheese using four stools */ #include "FourCheeseStools.h" #include #include int main(void) { int numCheeses, i; moveInfo_t optimalPlan; move_t *myMoveList; printf("Enter the number of cheese rounds in the stack: "); scanf("%d", &numCheeses); optimalPlan= fourStoolMove(numCheeses); printf("You can move %d cheese rounds in %d moves\n", numCheeses, optimalPlan.moves); printf("provided you move the top %d rounds to an intermediate stool.\n\n", numCheeses - optimalPlan.splitIndex); myMoveList= moveList(numCheeses, 'A', 'D', 'B', 'C'); for (i= 0; !(myMoveList[i].fromStool == '\0' && myMoveList[i].toStool == '\0'); i++) { printf("From stool %c to stool %c\n", myMoveList[i].fromStool, myMoveList[i].toStool); } free(myMoveList); /* assume it was allocated in FourCheeseStools.c */ return 0; }