//Let's try an easy one. The more ones, the better int intFit = 0; for(int i=0; i<colMax; i++) { if(arrayBody[row][i]==1) {intFit++;} } //normalise and return return ((double)intFit)/((double)(colMax));