00001 #ifndef AntEvalOp_h
00002 #define AntEvalOp_h
00003
00004
00050 class AntEvalOp : public EvaluateOp
00051 {
00052 friend ostream& operator<<(ostream& os, AntEvalOp& ant);
00053 protected:
00054
00055 uint x_, y_;
00056 uint facing_;
00057 uint moves_;
00058 uint foodEaten_;
00059
00060
00061 std::vector<uint> rowNo;
00062 std::vector<uint> columnNo;
00063 std::vector<uint> maxSteps;
00064 std::vector<uint> foodNo;
00065 std::vector<char*> board;
00066
00067
00068 uint tmpRow;
00069 uint tmpColumn;
00070 uint tmpMaxSteps;
00071 uint tmpFoodNo;
00072 uint boardNo;
00073 uint boardNo2;
00074 char *tmpBoard;
00075
00076 StateP state_;
00077
00078
00079 static const char LEFT, RIGHT, UP, DOWN;
00080 string currentTree;
00081 void showStep(string action);
00082
00083 public:
00084
00085 static bool trace;
00086 static bool step;
00087
00088 void registerParameters(StateP);
00089 FitnessP evaluate(IndividualP individual);
00090 bool initialize(StateP);
00091
00092
00093 void turnLeft();
00094 bool facingFood();
00095 void turnRight();
00096 void moveAhead();
00097
00098 };
00099 typedef boost::shared_ptr<AntEvalOp> AntEvalOpP;
00100
00101 #endif