2 ////////////////////////////////////////////////////////////////////////////////
3 // This program is free software; you can redistribute it and/or //
4 // modify it under the terms of the GNU General Public License //
5 // version 2 as published by the Free Software Foundation. //
7 // This program is distributed in the hope that it will be useful, but //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
10 // General Public License for more details. //
12 // Written and (C) by François Fleuret //
13 // Contact <francois.fleuret@epfl.ch> for comments & bug reports //
14 ////////////////////////////////////////////////////////////////////////////////
16 // $Id: task.h,v 1.18 2006-12-17 19:22:19 fleuret Exp $
22 #include "simple_window.h"
30 // A canonical name for the task, upper caps, digits and "_"
31 virtual char *name() = 0;
32 // A task can be started with several degrees of difficulty
33 virtual int nb_degrees() = 0;
34 // Returns the size of the area
35 virtual int width() = 0;
36 virtual int height() = 0;
37 // Initializes the world (put polygons with Universe::add_polygon)
38 virtual void init(Universe *universe, int degree) = 0;
40 virtual void update(scalar_t dt, Universe *universe, Manipulator *manipulator) = 0;
41 // Computes and returns the reward (can be positive or negative)
42 virtual scalar_t reward(Universe *universe, Manipulator *manipulator) = 0;
43 // If we need to draw something
44 virtual void draw(SimpleWindow *window) = 0;
47 // Loads a shared object file
49 Task *load_task(char *filename);