#include "FriendlyRobot.cpp" int main(int argc, char **argv) { int i; class FriendlyRobot TheClass; int retval; string instructions; int changesAllowed; if (argc != 2) { fprintf(stderr, "usage: a.out num\n"); exit(1); } if (((string) argv[1]) == "-") { cin >> instructions >> changesAllowed; } else { if (atoi(argv[1]) == 0) { instructions = "UULRRLLL"; changesAllowed = 1; } if (atoi(argv[1]) == 1) { instructions = "ULDR"; changesAllowed = 0; } if (atoi(argv[1]) == 2) { instructions = "ULDR"; changesAllowed = 2; } if (atoi(argv[1]) == 3) { instructions = "ULDRRLRUDUDLURLUDRUDL"; changesAllowed = 4; } if (atoi(argv[1]) == 4) { instructions = "LRLDRURDRDUDDDDRLLRUUDURURDRRDRULRDLLDDDDRLRRLLRRDDLRURLRULLLLLRRRDULRULULRLRDLLDDLLRDLUUDUURRULUDUDURULULLDRUDUUURRRURUULRLDLRRRDLLDLRDUULUURUDRURRLURLDLDDUUURRURRLRDLDDULLUDLUDULRDLDUURLUUUURRLRURRDLRRLLLRDRDUUUDRRRDLDRRUUDUDDUDDRLUDDULRURRDRUDLDLLLDLUDDRLURLDUDRUDDDDURLUUUDRLURDDDDLDDRDLUDDLDLURR"; changesAllowed = 47; } if (atoi(argv[1]) == 5) { instructions = "UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU"; changesAllowed = 300; } if (atoi(argv[1]) == 6) { instructions = "UD"; changesAllowed = 1; } if (atoi(argv[1]) == 7) { instructions = "UUUUDDLDLRRL"; changesAllowed = 1; } } retval = TheClass.findMaximumReturns(instructions, changesAllowed); cout << retval << endl; exit(0); }