diff --git a/src/main.c b/src/main.c index 320eee1..1d48cfd 100644 --- a/src/main.c +++ b/src/main.c @@ -1,10 +1,12 @@ #include "control.h" +#include "path.h" #include int main(int argc, char **argv) { trial *t; + path *p; if (argc <= 2) { fprintf(stderr, "Syntax: %s hostname port\n", argv[0]); @@ -14,7 +16,16 @@ int main(int argc, char **argv) { if (NULL == (t = trial_new(argv[1], argv[2]))) { return 2; } + + /*create trivial path towards the origin*/ + p = path_new(&t->map,&t->vehicle); + while(t->alive){ + trial_wait_for_input(t); + path_execute(t,p); + } + + path_free(p); trial_free(t); return 0; diff --git a/src/path.h b/src/path.h index f0168d1..8ef5b72 100644 --- a/src/path.h +++ b/src/path.h @@ -1,19 +1,24 @@ #ifndef _PATH_H #define _PATH_H +#include "control.h" + struct path; typedef struct path path; +struct command; +typedef struct command command; + struct command{ timestamp ts; accel_t accel; turn_t turn; -} +}; struct path { GQueue* commands; -} +}; command *command_new(timestamp ts, accel_t a, turn_t t); void command_free(command* c); diff --git a/src/wscript b/src/wscript index 0f2bcbc..8da3453 100644 --- a/src/wscript +++ b/src/wscript @@ -6,6 +6,7 @@ main_source = ''' main.c control.c + path.c ''' def build(bld):