Fixed the one-node tree bug

This commit is contained in:
Anna Rose 2011-07-01 11:48:49 -04:00
parent ec2b513fe5
commit 7b4b3ba76e

View File

@ -125,8 +125,7 @@ float GameData::calculate_strength(Vertex* node)
list<Vertex*> visited;
// Special case - a one-node tree just returns its own score!
list<Vertex*> all_nodes = get_colour(node->colour);
if (all_nodes.size() == 1) return (float)node->score;
if (node->neighbors.empty()) return (float)node->score;
return calculate_strength_r(node, 0, visited);
}