void Animal::Hunt(){ int caught = 0; // Flag for if gazelle is caught NODE* current = head; int gx; int gy; char temp; while(caught != 1){ // Until the gazelle has ben caught while(current != NULL){ if(current->Type = 'G'){ // Get gazelle x and y positions gx = current->curr_x; // gx = Gazelle at x gy = current->curr_y; // gy = Gazelle at y } current = current->next; // Iterate current } current = head; // Reset current for lions to chase while(current != NULL){ // the gazelle if (current->Type = 'L'){ Push(current->curr_x, current->curr_y, temp = '#'); if(gx > current->curr_x){ // Increase or decrease lion x position current->curr_x - 1; } if(gx < current->curr_x){ current->curr_x + 1; } if(gy > current->curr_y){ // Increase of decrease lion y position current->curr_y - 1; } if(gy < current->curr_y){ current->curr_y + 1; } // If gazelle has been caught if(gx == current->curr_x && gy == current->curr_y){ caught = 1; // Has been caught, get out of loop cout << "\n\n***The gazelle has been caught!***" << endl; return; } } current = current->next; // Iterate current } } } Output: /** Constantine Mavromichalis **/ /** Programming Assignment 3 **/ /** Bruce Bolden CS 121 **/ *** Please specify file: *** data.txt L L L G ***The gazelle has been caught!*** L L L L Press ENTER to continue.