@Override
    public boolean equals(Object o){
        //set up a boolean to track if the objects are the same
        boolean same = true;
        //check if we a comparing a Chromosome object
        if ( o instanceof Chromosome ){
            //get the array of Genes from the object passed in
            ArrayList<Gene> genesToCompare = ((Chromosome)o).getGenes();
            //if the two sizes are different then set same value to false
            //these are not meaningfully the same!
            if ( genes.size() != genesToCompare.size() ){
                same = false;
            }else{
                //cycle through the gene objects in both objects 
                //comparing them
                for (int i = 0; i < genes.size(); i++) {
                    //if one gene is not the same set the same variable to 
                    //false and then break out of the for-loop, no point in
                    //continuing with the comparison.
                    if (!genes.get(i).equals(genesToCompare.get(i))){
                        same = false;
                        break;
                    }
                }
            }
        //If the object is not a Chromosome object set same to false
        }else{
            same = false;
        }
        
        //return whether the objects are the same or not
        return same;
    }