First task debug with skip
This commit is contained in:
parent
21de3b1404
commit
f973a438da
@ -9,6 +9,8 @@
|
||||
#define GSTR_LEN(x) (x) ? (x)->str : "", (x) ? (x)->len : 0
|
||||
#define GSTR_SAFE_STR(x) ((x && x->str) ? x->str : "(null)")
|
||||
|
||||
#define UNUSED(x) ((void)(x))
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -17,12 +17,13 @@ void task_free(task_t *task);
|
||||
void ovm_init();
|
||||
void ovm_step(gdouble scenario, gdouble *in, gdouble *out);
|
||||
|
||||
static inline void task_run(task_t *task, task_app_t app) {
|
||||
static inline gdouble task_run(task_t *task, task_app_t app) {
|
||||
ovm_init();
|
||||
while (task->out[0] == 0.0) {
|
||||
app(task);
|
||||
ovm_step(task->scenario, task->in, task->out);
|
||||
}
|
||||
return task->out[0];
|
||||
}
|
||||
|
||||
#endif
|
22
ovm/task1.c
22
ovm/task1.c
@ -1,6 +1,26 @@
|
||||
|
||||
#include "base.h"
|
||||
#include "task.h"
|
||||
|
||||
static void debug(task_t * task) {
|
||||
gdouble *o = task->out;
|
||||
g_debug(
|
||||
"Score: %5f Fuel: %5f x: %5f y: %5f r: %5f\n",
|
||||
o[0], o[1], o[2], o[3], o[4]);
|
||||
}
|
||||
|
||||
static void run(task_t *task) {
|
||||
debug(task);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
task_t *task;
|
||||
gdouble score;
|
||||
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
task = task_new(1001.0, 4, 5);
|
||||
score = task_run(task, run);
|
||||
printf("Final Score: %f\n", score);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user