06_STD: Anpassungen, mehr Punkte vergeben
This commit is contained in:
parent
6e406b3832
commit
cd1fc54c84
|
@ -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
|
||||
for(std::pair<char, int> c : characterCount) {
|
||||
int charCount = c.second / 2;
|
||||
if(charCount == string1map[c.first] && charCount == string2map[c.first]) {
|
||||
equalCharCount++;
|
||||
}
|
||||
if(equalChars > 0) {
|
||||
points += characterCount.size() / equalChars * 10;
|
||||
}
|
||||
if(equalCharCount > 0) {
|
||||
points += characterCount.size() / equalCharCount;
|
||||
std::cout << "equalCharCount = " << equalCharCount << std::endl;
|
||||
}
|
||||
|
||||
|
||||
//gleiche Anzahl an gleichen Zeichen +10 Punkte
|
||||
if(equalCharCount == characterCount.size()) points += 10;
|
||||
|
||||
//TODO: Punkte für gleiche Buchstaben und gleiche Buchstaben Anzahl vergeben
|
||||
|
||||
|
|
Loading…
Reference in New Issue