/** * Perform the actual movement */ void Organism::move() { // Do not move more than once in an update if (hasMoved || !active) return; double angle, translation = 0; // Calculate the combined angle and speed of the robots combineVectors(angle, translation); // Move all the agents using the combined angle // and speed. moveOrganism(angle, translation); // Did we collide with anything? if (detectCollisions()) { // Then roll the movement back rollbackMove(); } else { updateWorldModels(); } // Anyway, we are done moving this movement this->hasMoved = true; // So update the sensors updateSensors(); }
vector<iPoint2D> *SolvingSudokuBoard::combineVectors(vector<iPoint2D> *a, vector<iPoint2D> *b) { vector<iPoint2D> **vectors = new vector<iPoint2D>*[2]; //array of pointers // why would it do a pointer to an array? vectors[0] = a; vectors[1] = b; vector<iPoint2D> *returnVal = combineVectors(2, vectors); delete[] vectors; //the contents are the inputs. We don't want to delete inputs. return returnVal; }