#include #include #include #include #include #include #include using namespace std; class coordinate { public: int X; int Y; }; class Dog { public: int fitness; int path[1000]; double share; coordinate c; }; int StSousage(Dog dog) { coordinate point; point.X = 500; point.Y = 500; for (int i = 0; i<1000; i++) { switch (dog.path[i]) { case 0: point.Y--; break; case 1: point.Y++; break; case 2: point.X--; break; case 3: point.X++; break; default: cout << "Error step" << endl; system("Pause"); exit(1); break; } } int Step[4] = { 0 }; Step[0] = abs(point.X - 200) + abs(point.Y - 800); Step[1] = abs(point.X - 800) + abs(point.Y - 800); Step[2] = abs(point.X - 200) + abs(point.Y - 200); Step[3] = abs(point.X - 800) + abs(point.Y - 200); int min = INT_MAX; for (int i = 0; i<4; i++) { if (Step[i] childDog2.fitness) predstav[i] = childDog1; else predstav[i] = childDog2; } for (int i = 0; i<12; i++) if (predstav[i].fitness == 200) break; cout << endl; if (iteration != 20) cout << "Iteration number: "<< iteration << endl; iteration++; if (iteration == 21) break; } system("Pause"); return 0; }