tturns_small.c (1127B)
1 /*** 2 * tturns_small.c 3 * 4 * Ryan Wolf 5 * 6 *** 7 * version 2: same great taste, plus the commandline 8 * arguements you want. 9 *** 10 * outputs a dot file of all of the relationships between 11 * possible states of a game of twist turns 12 * usage: 13 * $ time ./tturns_small 3 2 14 * graph T { 15 * "2 1 0 " -- "1 2 0 "; 16 * "2 1 0 " -- "1 0 2 "; 17 * "2 1 0 " -- "0 2 1 "; 18 * "1 2 0 " -- "2 1 0 "; 19 * "1 2 0 " -- "2 0 1 "; 20 * "1 2 0 " -- "0 1 2 "; 21 * "2 0 1 " -- "0 2 1 "; 22 * "2 0 1 " -- "0 1 2 "; 23 * "2 0 1 " -- "1 2 0 "; 24 * "0 2 1 " -- "2 0 1 "; 25 * "0 2 1 " -- "2 1 0 "; 26 * "0 2 1 " -- "1 0 2 "; 27 * "1 0 2 " -- "0 1 2 "; 28 * "1 0 2 " -- "0 2 1 "; 29 * "1 0 2 " -- "2 1 0 "; 30 * "0 1 2 " -- "1 0 2 "; 31 * "0 1 2 " -- "1 2 0 "; 32 * "0 1 2 " -- "2 0 1 "; 33 * } 34 * 35 * real 0m0.002s 36 * user 0m0.000s 37 * sys 0m0.004s 38 * 39 ***/ 40 41 #include <stdio.h> 42 #include <stdlib.h> 43 #include "utils.h" // twist turns utilities 44 45 main(int argc, char* argv[]) { 46 if (argc == 3 && atoi(argv[1]) >= atoi(argv[2])) { 47 state universe = build_universe(atoi(argv[1]),atoi(argv[2])); 48 print_states_dot(universe); 49 } 50 else { 51 printf(" usage: .tturns_small 'number of tiles' 'diameter of wheel'\n"); 52 } 53 return 0; 54 }