Automatic commit
[universe.git] / task.h
1
2 // Written and (C) by Francois Fleuret
3 // Contact <francois.fleuret@idiap.ch> for comments & bug reports
4
5 #ifndef TASK_H
6 #define TASK_H
7
8 #include "misc.h"
9 #include "simple_window.h"
10
11 class Manipulator;
12 class Universe;
13
14 class Task {
15 public:
16   virtual ~Task();
17   // A canonical name for the task, upper caps, digits and "_"
18   virtual const char *name() = 0;
19   // A task can be started with several degrees of difficulty
20   virtual int nb_degrees() = 0;
21   // Returns the size of the area
22   virtual int width() = 0;
23   virtual int height() = 0;
24   // Initializes the world (put polygons with Universe::add_polygon)
25   virtual void init(Universe *universe, int degree) = 0;
26   // Updates the world
27   virtual void update(scalar_t dt, Universe *universe, Manipulator *manipulator) = 0;
28   // Computes and returns the reward (can be positive or negative)
29   virtual scalar_t reward(Universe *universe, Manipulator *manipulator) = 0;
30   // If we need to draw something
31   virtual void draw(SimpleWindow *window) = 0;
32 };
33
34 // Loads a shared object file
35
36 Task *load_task(const char *filename);
37
38 #endif