From: Mart Lubbers Date: Thu, 24 Mar 2016 18:36:46 +0000 (+0100) Subject: nice' X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=ac779b7b55a13e62238b69eb14ae036b831ee20d;p=mc1516pa.git nice' --- diff --git a/modelchecker/main.c b/modelchecker/main.c index 409f506..56fb6bd 100644 --- a/modelchecker/main.c +++ b/modelchecker/main.c @@ -39,18 +39,18 @@ void solve(FILE *inputstream){ time_start_read = clock(); struct sokoban_screen *screen = parse_screen(inputstream); - while(screen != NULL){ - switch(screen->tile){ - case FREE: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "FREE");break; - case WALL: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "WALL");break; - case BOX: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "BOX");break; - case TARGET: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "TARGET");break; - case AGENT: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "AGENT");break; - case TARGAGENT: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "TARGAGENT");break; - case TARGBOX: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "TARGBOX");break; - } - screen = screen->next; - } + while(screen != NULL){ + switch(screen->tile){ + case FREE: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "FREE");break; + case WALL: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "WALL");break; + case BOX: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "BOX");break; + case TARGET: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "TARGET");break; + case AGENT: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "AGENT");break; + case TARGAGENT: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "TARGAGENT");break; + case TARGBOX: printf("x = %d y = %d tile = %s\n", screen->x, screen->y, "TARGBOX");break; + } + screen = screen->next; + } //parse_screen(inputstream); time_end_read = clock(); diff --git a/modelchecker/sokoban.c b/modelchecker/sokoban.c index 1abda09..9d42daf 100644 --- a/modelchecker/sokoban.c +++ b/modelchecker/sokoban.c @@ -1,38 +1,38 @@ #include #include -#include "sokoban.h" +#include "sokoban.h" -//Still need to remove outside walls +//Still need to remove outside walls and unreachable places. struct sokoban_screen *parse_screen(FILE *stream){ - int buffer, x, y; - x = 0; - y = 0; - struct sokoban_screen *head, *current; - head = NULL; - while((buffer = fgetc(stream)) != EOF){ - if (buffer == '\n'){ - x = 0; - y++; - } - else { - current = (struct sokoban_screen *)malloc(sizeof(struct sokoban_screen)); - current->next = head; - switch(buffer) { - case ' ' : current->tile = FREE; break; - case '@' : current->tile = AGENT; break; - case '.' : current->tile = TARGET; break; - case '#' : current->tile = WALL; break; - case '$' : current->tile = BOX; break; - case '*' : current->tile = TARGBOX; break; - case '+' : current->tile = TARGAGENT; break; - default: return NULL; - } - current->x = x; - current->y = y; - x++; - head = current; - } - } - return head; - } + int buffer, x, y; + x = 0; + y = 0; + struct sokoban_screen *head, *current; + head = NULL; + while((buffer = fgetc(stream)) != EOF){ + if (buffer == '\n'){ + x = 0; + y++; + } + else { + current = (struct sokoban_screen *)malloc(sizeof(struct sokoban_screen)); + current->next = head; + switch(buffer) { + case ' ' : current->tile = FREE; break; + case '@' : current->tile = AGENT; break; + case '.' : current->tile = TARGET; break; + case '#' : current->tile = WALL; break; + case '$' : current->tile = BOX; break; + case '*' : current->tile = TARGBOX; break; + case '+' : current->tile = TARGAGENT; break; + default: return NULL; + } + current->x = x; + current->y = y; + x++; + head = current; + } + } + return head; +}