int main(int argc, char * argv[]) if (argc != 1) std::cerr << "Command format is \"" << argv[0] << "\".\n" return EXIT_FAILURE animate_boxes(std::cout, read_script(std::cin))
int main(int argc, char **argv) vector<string> vsStdInput = getInputRows() vector<Box> vBoxes MO_Vector vMoveOrders getBoxesMoves(vsStdInput, vBoxes, vMoveOrders) calcMoves(vMoveOrders) processMoves(vBoxes, vMoveOrders)
void animate_boxes( std::ostream & os, animation_script boxes) unsigned time = 0, next_step_time while true draw_boxes(os, boxes) if (!boxes.nearest_step_time(next_step_time)) break usleep((next_step_time - time)*1000) time = next_step_time boxes.step()
nearest_step_time()
returns the time at the queue head.
step()
moves the queue head boxes to the next step.
100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000 | 1100 | 1200 | 1300 | 1400 | 1500 | 1600 | 1700 | 1800 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | |||||||||||||||||
10 | 1 | |||||||||||||||||
20 | 1 | 1 | ||||||||||||||||
30 | 1 | 1 | 1 | |||||||||||||||
40 | 1 | 1 | 2 | |||||||||||||||
50 | ||||||||||||||||||
60 | 2 | 1 | 1 | |||||||||||||||
70 | 1 | 1 | 1 | 1 | ||||||||||||||
80 | ||||||||||||||||||
90 | 2 | |||||||||||||||||
Totals | 1 | 1 | 1 | 2 | 4 | 3 | 5 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
000 | 100 | 200 | 300 | 400 | 500 | 600 | |
---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | ||||
10 | 3 | ||||||
20 | 2 | ||||||
30 | 1 | ||||||
40 | 1 | ||||||
50 | |||||||
60 | 1 | 1 | 1 | ||||
70 | 1 | 1 | |||||
80 | 1 | 1 | 1 | ||||
90 | 2 | 1 | |||||
Totals | 2 | 1 | 7 | 6 | 3 | 1 | 1 |
total | pages per procedure | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
procs | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
11 | 11 | |||||||||||||||||
11 | 6 | 4 | 1 | |||||||||||||||
11 | 8 | 1 | 1 | 1 | ||||||||||||||
12 | 7 | 1 | 4 | |||||||||||||||
13 | 10 | 1 | 1 | 1 | ||||||||||||||
16 | 9 | 5 | 1 | 1 | ||||||||||||||
19 | 14 | 3 | 1 | 1 | ||||||||||||||
19 | 18 | 1 | ||||||||||||||||
20 | 16 | 3 | 1 | |||||||||||||||
24 | 20 | 3 | 1 | |||||||||||||||
30 | 28 | 2 | ||||||||||||||||
33 | 26 | 5 | 1 | 1 | ||||||||||||||
38 | 26 | 6 | 5 | 1 | ||||||||||||||
39 | 33 | 4 | 1 | 1 | ||||||||||||||
49 | 48 | 1 | ||||||||||||||||
77 | 70 | 6 | 1 | |||||||||||||||
bool checkForColor(string str) if ((strcmp(str.c_str(), "black") == 0) | (strcmp(str.c_str(), "red") == 0) | (strcmp(str.c_str(), "green") == 0) | (strcmp(str.c_str(), "yellow") == 0) | (strcmp(str.c_str(), "blue") == 0) | (strcmp(str.c_str(), "magenta")== 0) | (strcmp(str.c_str(), "cyan" )== 0) | (strcmp(str.c_str(), "white") == 0)) return true else return false
bool checkForColor(string str) return str == "black" || str == "red" || str == "green" || str == "yellow" || str == "blue" || str == "magenta" || str == "cyan" || str == "white";
This page last modified on 22 November 2002.