14 void usage(char *prg
){
17 "\t%s [opts] [FILE [FILE [...]]]\n"
20 "\tAll strategies are mutually exclusive\n"
21 "\t-c coordinate based strategy\n"
22 "\t-o object based strategy\n"
23 "\t-y hybrid strategy\n"
24 // "\t-l LURD lURD verification strategy\n"
25 // "\t-r show all positions that are a valid solution\n"
27 "\t-d enable verbose debug output\n"
28 "\t-h show this help\n"
30 "Positional arguments:\n"
31 "\tFILE zero or more sokoban screens\n"
32 "\t when no file is specified stdin will be used\n", prg
);
35 void solve(FILE *inputstream
){
37 while((buffer
= fgetc(inputstream
)) != EOF
){
42 // - Removing outside walls
45 // - tile = structure {int, int, enumtile}
47 // Both: Encoding in both schemes
52 int main(int argc
, char **argv
){
53 strategy strat
= HYBRID
;
56 while((optchar
= getopt(argc
, argv
, "cdhoy")) != -1){
60 if(DEBUG
) fprintf(stderr
, "Strategy changed to Coordinate based\n");
64 if(DEBUG
) fprintf(stderr
, "Debug enabled\n");
71 if(DEBUG
) fprintf(stderr
, "Strategy changed to Object based\n");
75 if(DEBUG
) fprintf(stderr
, "Strategy changed to Hybrid\n");
79 fprintf(stderr
, "Unknown option `-%c'.\n", optopt
);
81 fprintf(stderr
, "Unknown option char `-\\x%x'.\n", optopt
);
90 fprintf(stderr
, "You have not specified a file, reading from stdin\n");
94 for(int filepathindex
= optind
; filepathindex
< argc
; filepathindex
++){
95 char *currentfilepath
= argv
[filepathindex
];
96 fprintf(stderr
, "Processing: %s\n", currentfilepath
);
97 if(DEBUG
) fprintf(stderr
, "Strategy: %d\n", strat
);
98 FILE *currentfile
= fopen(currentfilepath
, "r");
99 if(DEBUG
) fprintf(stderr
, "Opening file\n");
101 if(DEBUG
) fprintf(stderr
, "Closing file\n");