-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "approximer.h"
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef APPROXIMER_H
#define APPROXIMER_H
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "task.h"
#include "universe.h"
class Dummy : public Task {
public:
- virtual char *name() { return "DUMMY"; }
+ virtual const char *name() { return "DUMMY"; }
virtual int nb_degrees() { return 1; }
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "task.h"
#include "universe.h"
public:
- virtual char *name() { return "HIT_SQUARE"; }
+ virtual const char *name() { return "HIT_SQUARE"; }
virtual int nb_degrees() { return 1; }
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "intelligence.h"
int Intelligence::best_action() {
int max_a = -1;
- scalar_t q, max_q;
+ scalar_t q, max_q = 0;
cout << "ACTION_SCORES";
for(int a = 0; a < _nb_actions; a++) {
q = _q_predictors[a]->predict(_input->parameters);
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "map.h"
#include "approximer.h"
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include <iostream>
#include <fstream>
//////////////////////////////////////////////////////////////////////
-void check_opt(int argc, char **argv, int n_opt, int n, char *help) {
+void check_opt(int argc, char **argv, int n_opt, int n, const char *help) {
if(n_opt + n >= argc) {
cerr << "Missing argument for " << argv[n_opt] << "." << endl;
cerr << "Expecting " << help << "." << endl;
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "manipulator.h"
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef MANIPULATOR_CC
#define MANIPULATOR_CC
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "map.h"
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef MAP_H
#define MAP_H
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "misc.h"
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef MISC_H
#define MISC_H
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "task.h"
#include "universe.h"
public:
- virtual char *name() { return "MOVE_SQUARE"; }
+ virtual const char *name() { return "MOVE_SQUARE"; }
virtual int nb_degrees() { return 5; }
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include <cmath>
#include "polygon.h"
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef POLYGON_H
#define POLYGON_H
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "retina.h"
}
}
-void Retina::save_as_ppm(char *filename) {
+void Retina::save_as_ppm(const char *filename) {
unsigned char *image = new unsigned char[_width * _height * 3];
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef RETINA_H
#define RETINA_H
void draw_on_universe(SimpleWindow *window);
void draw_parameters(int x0, int y0, SimpleWindow *window);
- void save_as_ppm(char *filename);
+ void save_as_ppm(const char *filename);
};
#endif
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "simple_window.h"
SimpleEvent::SimpleEvent() : type(UNDEFINED) {}
-SimpleWindow::SimpleWindow(char *name, int x, int y, int w, int h) {
+SimpleWindow::SimpleWindow(const char *name, int x, int y, int w, int h) {
_width = w; _height = h;
XDrawArc(_display, _pixmap, _gc, x-r, y-r, 2*r, 2*r, 0, 360*64);
}
-void SimpleWindow::draw_text(char *s, int x, int y) {
+void SimpleWindow::draw_text(const char *s, int x, int y) {
XDrawString(_display, _pixmap, _gc, x, y, s, strlen(s));
}
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef SIMPLE_WINDOW_H
#define SIMPLE_WINDOW_H
int _width, _height;
public:
- SimpleWindow(char *name, int x, int y, int w, int h);
+ SimpleWindow(const char *name, int x, int y, int w, int h);
virtual ~SimpleWindow();
virtual int width();
virtual void draw_point(int x, int y);
virtual void draw_line(int x1, int y1, int x2, int y2);
virtual void draw_circle(int x, int y, int r);
- virtual void draw_text(char *s, int x, int y);
+ virtual void draw_text(const char *s, int x, int y);
virtual void fill_rectangle(int x, int y, int w, int h);
virtual void fill_polygon(int nb, int *x, int *y);
virtual void show();
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include <iostream>
#include <dlfcn.h>
typedef Task *TaskConstructor();
-Task *load_task(char *filename) {
+Task *load_task(const char *filename) {
void *handle = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
if(handle == 0) {
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef TASK_H
#define TASK_H
public:
virtual ~Task();
// A canonical name for the task, upper caps, digits and "_"
- virtual char *name() = 0;
+ virtual const char *name() = 0;
// A task can be started with several degrees of difficulty
virtual int nb_degrees() = 0;
// Returns the size of the area
// Loads a shared object file
-Task *load_task(char *filename);
+Task *load_task(const char *filename);
#endif
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "universe.h"
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#ifndef UNIVERSE_H
#define UNIVERSE_H
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "variables.h"
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or //
-// modify it under the terms of the GNU General Public License //
-// version 2 as published by the Free Software Foundation. //
-// //
-// This program is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// General Public License for more details. //
-// //
-// Written and (C) by François Fleuret //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
#include "misc.h"