06_STD: Anpassungen, mehr Punkte vergeben

This commit is contained in:
Johannes Theiner 2018-11-15 14:59:28 +01:00
parent 6e406b3832
commit cd1fc54c84
1 changed files with 7 additions and 13 deletions

View File

@ -59,21 +59,15 @@ int stringSimilarity(std::string string1, std::string string2) {
if(string1map.size() == string2map.size()) points += 10;
int equalCharCount = 0;
int equalChars = 0;
for(std::pair<char, int> count : characterCount) {
//BUG: equalCharCount ist nicht immer korrekt
if(string1map[count.first] == string2map[count.first]) equalCharCount++;//gleiche Anzahl an gleichen Zeichen
if(string1map[count.first] != 0 && string2map[count.first] != 0) equalChars++;//Zeichen exsistiert in beiden
}
if(equalChars > 0) {
points += characterCount.size() / equalChars * 10;
}
if(equalCharCount > 0) {
points += characterCount.size() / equalCharCount;
std::cout << "equalCharCount = " << equalCharCount << std::endl;
for(std::pair<char, int> c : characterCount) {
int charCount = c.second / 2;
if(charCount == string1map[c.first] && charCount == string2map[c.first]) {
equalCharCount++;
}
}
//gleiche Anzahl an gleichen Zeichen +10 Punkte
if(equalCharCount == characterCount.size()) points += 10;
//TODO: Punkte für gleiche Buchstaben und gleiche Buchstaben Anzahl vergeben