#ifndef _GHOST_H_ #define _GHOST_H_ #include #include "maze.h" //#define PHEROMONES class Ghost { public: void init ( char* inProgram, char* inNewProgram, int* inProgramLength, int* inNewProgramLength); void move (); void newGame(); void newGeneration(); void outputProgram (ostream& out = cout); static Maze * maze; bool checkProgramLength (); void mutate (Ghost& parent); void copy (Ghost& parent); void crossover (Ghost& mom, Ghost& dad); static const int MAX_PROGRAM_LENGTH; private: enum DataType {Direction, Number, Bool}; DataType dataType (int point); static const int MAX_NEW_PROGRAM_LENGTH; static const int MAX_MUTATED_SUBTREE_LENGTH; static const int MAX_RANDOM_MATCH_TRIES; static const int MAX_INTEGER_LENGTH; static const int MAX_FLOAT_LENGTH; void moveCursorRight (ostream& out, int depth); void outputDirection (ostream& out, int depth); void outputBool (ostream& out, int depth); void outputNumber (ostream& out, int depth); int mutateDirection (int maxTreeDepth); int mutateBool (int maxTreeDepth); int mutateNumber (int maxTreeDepth); int combinationPoint (); bool badCombinationPoint (int point); int matchingPoint (int point); int pointOfType (DataType dt); int getDirection (); bool getBool (); float getNumber (); void skip(); int* programLength; int* newProgramLength; int consec; int lastDirection; bool directionOK(int dir); void makeMove(int dir); int x, y; char* program; char* newProgram; char* programIndex; }; #endif