Generates neural net instances through genetic algorithm for use in task learning by m3pi. Reward determined by detection of black areas on arena floor, or by amount of area explored in limited time. Due to memory size, limited # of nets.

Dependencies:   Ping m3pimaze mbed

Revision:
0:ac93d9db8dbd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Code/utils.h	Thu Apr 23 20:16:51 2015 +0000
@@ -0,0 +1,27 @@
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <stdlib.h>
+#include <math.h>
+#include <vector>
+
+using namespace std;
+
+// Random number functions
+
+//returns a random integer between x and y
+inline int RandInt(int x,int y) {return rand()%(y-x+1)+x;}
+
+//returns a random float between zero and 1
+inline float RandFloat() {return (rand())/(RAND_MAX+1.0);}
+
+//returns a random float in the range -1 < n < 1
+inline float RandomClamped() {return RandFloat() - RandFloat();}
+
+inline void Squash(float &arg, int obj, float min, float max){
+    arg = arg/obj - 1;
+    if (arg < min){arg = min;}
+    if (arg > max){arg = max;}
+}
+
+#endif
\ No newline at end of file