Seed.cpp
void Seed::readFile(std::string name) {
        
    // open the file
    std::string fileName = name + "_106.lif";
    std::ifstream inputFile;
    inputFile.open(fileName.c_str());
    
    // read the header line
    std::string header;
    getline(inputFile,header);
    
    // read the coordinates from file
    coord myCoord;
    pattern.clear();
    while (inputFile >> myCoord.x >> myCoord.y) {
        pattern.push_back(myCoord);
    }
    inputFile.close();
    
    // calculate the length of the pattern and extent in x and y dimensions
    std::sort(pattern.begin(), pattern.end(), byX);
    sizeX = pattern.back().x - pattern.front().x + 1;
    std::sort(pattern.begin(), pattern.end(), byY);
    sizeY = pattern.back().y - pattern.front().y + 1;
    length = static_cast<int>(pattern.size());
}
/*********************************************************************
 ** Function: readFile
 ** Description: Read seed pattern from Life 1.06 format text file.
 ** Parameters: String with name of seed pattern.
 ** Pre-Conditions: The requested *.lif file must be in the same 
 **   directory as the executable.
 ** Post-Conditions:  The coordinates of the live cells in the pattern
 **   will be read into a vector.
 *********************************************************************/
readFile
Description: Read seed pattern from Life 1.06 format text file.
Parameters: String with name of seed pattern.
Pre-Conditions: The requested *.lif file must be in the same
directory as the executable.
Post-Conditions:  The coordinates of the live cells in the pattern
will be read into a vector.
readFile Description : Read seed pattern from Life 1 . 06 format text file . Parameters : String with name of seed pattern . Pre - Conditions : The requested * . lif file must be in the same directory as the executable . Post - Conditions : The coordinates of the live cells in the pattern will be read into a vector .
void Seed::readFile(std::string name) {
    std::string fileName = name + "_106.lif";
    std::ifstream inputFile;
    inputFile.open(fileName.c_str());
    std::string header;
    getline(inputFile,header);
    coord myCoord;
    pattern.clear();
    while (inputFile >> myCoord.x >> myCoord.y) {
        pattern.push_back(myCoord);
    }
    inputFile.close();
    std::sort(pattern.begin(), pattern.end(), byX);
    sizeX = pattern.back().x - pattern.front().x + 1;
    std::sort(pattern.begin(), pattern.end(), byY);
    sizeY = pattern.back().y - pattern.front().y + 1;
    length = static_cast<int>(pattern.size());
}
void Seed :: readFile ( std :: string name ) { std :: string fileName = name + " " ; std :: ifstream inputFile ; inputFile . open ( fileName . c_str ( ) ) ; std :: string header ; getline ( inputFile , header ) ; coord myCoord ; pattern . clear ( ) ; while ( inputFile >> myCoord . x >> myCoord . y ) { pattern . push_back ( myCoord ) ; } inputFile . close ( ) ; std :: sort ( pattern . begin ( ) , pattern . end ( ) , byX ) ; sizeX = pattern . back ( ) . x - pattern . front ( ) . x + 1 ; std :: sort ( pattern . begin ( ) , pattern . end ( ) , byY ) ; sizeY = pattern . back ( ) . y - pattern . front ( ) . y + 1 ; length = static_cast < int > ( pattern . size ( ) ) ; }
Function: readFile
 Description: Read seed pattern from Life 1.06 format text file.
Function : readFile Description : Read seed pattern from Life 1 . 06 format text file .
// open the file // read the header line // read the coordinates from file // calculate the length of the pattern and extent in x and y dimensions